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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to use Subtraction in SSRS report?

(0) ShareShare
ReportReport
Posted on by 3,732

Hi,

I have been working on SSRS reports. I have 2 totals in child group. Now I have to create a Balance from the parent group. That is Child 1 - Child 2, this is the scenario. How to achieve this? 

If anyone knows please update me with a screenshot? 

For example:

Child group 1: 100.00

                        200.00

Total 1:               300.00

Child group 2:  50.00

                        100.00

Total 2:               150.00

Balance:           150.00 (Total 1 - total 2)

This highlighted 150.00 I have to achieve it in SSRS report.

*This post is locked for comments

I have the same question (0)
  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    have you tried by adding one more footer row by right click and adding below expression

    Sum(Fields!FieldName.Value)

  • Sathish Sivakumar Profile Picture
    3,732 on at

    Hi Sohaib,

    I have tried this way. The way you suggested is doing Addition. My scenario is to Subtract.

  • Suggested answer
    Martin Dráb Profile Picture
    237,807 Most Valuable Professional on at

    =Sum(Fields!Field1.Value)-Sum(Fields!Field2.Value)

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    interesting. allow me to reproduce scenario and get back to you with my verdict

  • Verified answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    Since you are applying grouping on same field so you cannot use only sum subtract as you have grouped name field already.

    considering you are having limited number of groups only, I have reproduced your scenario as shown below

    SampleSSRSSubtract.png

    you can use expression as following

    =Sum(IIF(Fields!ChildName.Value="ABC",Fields!AnyNumber.Value,Nothing))-Sum(IIF(Fields!ChildName.Value="XYZ",Fields!AnyNumber.Value,Nothing))

    .

    .

    Note that you have same field name in both sum() and you are segregating the two sum expression by specifying Field Group expression

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    allow to add one thing more that in above expression provided by me,  Fields!ChildName means field name of column based on what you are grouping your data. such as in my example ABC and XYZ are being saved in a column of table, where column or field name is ChildName.

    Fields!AnyNumber; AnyNumber is another column name which is saving numbers. here goes my table schema

    SampleSSRSSubtrac2.png

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans