I am building a report in Microsoft SSRS 2016; I have multiple groups in my report, all these groupings are done via (the same) set of parameters. You can see the screen shot below:
1) I have 3 groups in SSRS 2016 Report Designer.
2) All 3 groups use the same expression (using parameters) to group report.
In a nutshell, if the parameter value is X, it is grouped by X; if that parameter value is Y, it is grouped by Y; I do this for many groups, creating many parameter.
I will have many more groups in the future, and hence many more parameter options,as the report grows. I am trying to figure out a way to optimize this SSRS 2016 report by writing this code JUST ONCE.
I tried to add a Report Variable as shown below:
Now I have a new Report Variable (GV2) that stores this code with Switch operator.
I now try to use this Report Variable across many different groups.
I get this error:
Variable values cannot be used in group expressions
Is there any other way to do this? I need to optimize this sort of parameterized grouping.
May be writing some custom codes in SSRS; if so, can you provide the code (my knowledge in .Net is zero!)
Thanks