When the condition is satisfied, below query prints out
instead of a date selected -1 day, however it does display the selected date when conditions are not met.
=IIF(Parameters!subscription.Value =0 AND Parameters!shiftId.Value = "Shift 3", Parameters!date.Value =DateAdd("d", -1, Parameters!date.Value), Parameters!date.Value)
Any idea what am I missing?
The issue is the second argument of the IIF
statement:
Parameters!date.Value =DateAdd("d", -1, Parameters!date.Value)
Which is doing a comparison between two values, and hence returning a boolean value.
All you need is the DateAdd
part of this:
=IIF(Parameters!subscription.Value =0 AND Parameters!shiftId.Value = "Shift 3"
, DateAdd("d", -1, Parameters!date.Value)
, Parameters!date.Value)