Search code examples
reporting-servicesssrs-2008reportingreportingservices-2005

SSRS Substracing Date returns False for valid If Statement


When the condition is satisfied, below query prints out

enter image description here

instead of a date selected -1 day, however it does display the selected date when conditions are not met.

enter image description here

=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?


Solution

  • 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)