C.C
C.C

Reputation: 179

sum values by different group in one table

enter image description here

I got Table 1 and Table 2 based on a same dataset, but different groupings.

For Table 1, it groups on Group 1 and Group 2, For Table 2, it groups on Group 1 only. I want something like the result table - to combine the results from Table 1 and Table 2.

The logic is =iif( Field name is C, sum values based on Group 2, sum values based on Group 1). It should be easy, but I can not figure out how to achieve that. Thank you for your help in advance.

Upvotes: 1

Views: 806

Answers (1)

alejandro zuleta
alejandro zuleta

Reputation: 14108

You can use an expression to determine the scoping group.

Create a tablix and set the group 1 like below (in my case Group3 in Column Groups). Then right click the group and go to Group properties.

enter image description here

In the General tab add an expression for Group on property and put this expression:

=IIF(
Fields!Group.Value="C",
Fields!SubGroup.Value,
Fields!Group.Value
)

Use the same expression in the header cell of the column group (the cell selected in the above image).

It will preview the following tablix:

enter image description here

Let me know if this helps you.

Upvotes: 1

Related Questions