web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Field that sums up four fields

(0) ShareShare
ReportReport
Posted on by 240

Hi,

I have a scenario where I have four fields which are currency fields.

I have created a field that will sum the four fields, I want it to plus field A+B+C+D.

Which is the best way to achieve this, to make sure the Sum field plus each of these four fields. So for example, if I only have two fields filled and other two blanks, the Sum field should sum the two ones

I have the same question (0)
  • Verified answer
    Anuj Profile Picture
    25 on at
    RE: Field that sums up four fields

    You can refer to the verified answer in below:

    community.dynamics.com/.../641877

  • Verified answer
    LuHao Profile Picture
    40,890 on at
    RE: Field that sums up four fields

    Hi partner,

    There are two solutions to this problem.

    1. No code - business rules and calculated fields.
    2. Code - Javascript.

    I introduce the first way here.

    Because as long as one of the four fields is empty, the field 'sum' will be empty. So we have to make the empty fields 0 first.

    In order not to change the values of the four fields themselves, we need to create auxiliary fields for them.

    • If the field is not empty, copy the value of the field to its auxiliary field.
    • If the field is empty, set its auxiliary field to 0.

    Finally, we use 4 auxiliary fields to set the calculation field.

    The downside is that four auxiliary fields are displayed on the form and are seen by users.

    Here are the detailed steps:

    1) This is field 'A' and its auxiliary field 'A copy'. The other three fields are B, C, and D. Add them to the form.

    5618.PNG    12607.PNG

    2) Create four business rules, set as follows:

    IF

    A contains data

    THEN
    Set A copy to A
    ELSE
    Set A copy to 0

    3.1.PNG

    Create the same business rules for B, C, and D.

    3) Create a calculated field 'sum' and set its logic to 'A copy + B copy + C copy + D copy'.

    36702.PNG    7573.PNG    4578.PNG

    4) Finally, set the four auxiliary fields to read-only on the form.

    77150.PNG

    The effect is as follows:

    3021.PNG

  • Denzo19913 Profile Picture
    240 on at
    RE: Field that sums up four fields

    Lu, you're the Man, keep up the good work and huge thanks!!!!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 125

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 110 Super User 2025 Season 2

#3
Erin Lubben Profile Picture

Erin Lubben 73

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans