Reputation: 3
In developing an SSRS 2008 R2 report, I'll like to show some data grouped by values, while merging others, I've run into a problem doing this on report builder.
| Parent Group |
|_______________________________________|
|Group A|Group B|Group C|Group D|Group E|
|_______|_______|_______|______|________|
| 5 | 2 | 1 | 1 | 5 |
| 4 | 2 | 4 | 2 | 2 |
| 1 | 3 | 1 | 3 | 2 |
Can I create a filter or grouping to combine Group C, D, E together while leaving A and B alone?
Like such,
| Parent Group |
|_____________________________|
|Group A |Group B|Other Groups|
|________|_______|____________|
| 5 | 2 | 7 |
| 4 | 2 | 8 |
| 1 | 3 | 6 |
Upvotes: 0
Views: 143
Reputation: 20560
There are two ways you can achieve this:
SQL query
Usually the best way to get the result you want is to let SQL do the heavy lifting:
SELECT GroupA, GroupB, (GroupC + GroupD + GroupE) AS OtherGroups
FROM MyTable
In the report
If you can't change your query result (for example, it is a stored procedure) then you can do the same thing in SSRS VB code.
Right-click the cell and choose Expression...
and enter something like the following:
=Fields!GroupC.Value + Fields!GroupD.Value + Fields!GroupE.Value
and SUM
in the same way:
=SUM(Fields!GroupC.Value) + SUM(Fields!GroupD.Value) + SUM(Fields!GroupE.Value)
Upvotes: 1