Assuming a parameter called Include
, you can use an expression like this:
=IIf(InStr(Join(Parameters!Include.Value, ","), "value1") > 0, Fields!value1.Value, 0)
+ IIf(InStr(Join(Parameters!Include.Value, ","), "value2") > 0, Fields!value2.Value, 0)
+ IIf(InStr(Join(Parameters!Include.Value, ","), "value3") > 0, Fields!value3.Value, 0)
+ IIf(InStr(Join(Parameters!Include.Value, ","), "value4") > 0, Fields!value4.Value, 0)
This uses the Join
function to create a comma-delimited string of the selected parameters, checks for a particular parameter value being selected, then add either the corresponding value or 0 to the total.
Here's a simple report with the expression:
All values selected:
Two values selected: