Tim S.
Tim S.

Reputation: 380

SSRS - if the field that a report is grouped on is blank, can you group on a different column instead?

In SSRS, I have a report that is grouped by Employee ID, then a subgroup on a field named Code1. This sub-group has subtotals at the end. Code1 can sometimes be blank or null and in these cases the users want the report to be grouped on a different field named Code2 rather than group all the blank Code1 fields. Is that possible?

Upvotes: 0

Views: 2062

Answers (1)

user2191219
user2191219

Reputation: 36

In your sql add a column using the isnull function-- select isnull(code1,code2) as GroupCode from... then use GroupCode as your subgroup field in the report.

Or alternatively in the report you can create an expression for the group-- =IIF(IsNothing(Fields!Code1.Value),Fields!Code2.Value,Fields!Code1.Value)

Either does the same thing--testing code1 for a value, and if there isn't one, use code2.

Upvotes: 1

Related Questions