Search code examples
reporting-servicesdatediffdateadd

SSRS: Compare with a specific time on the previous day


IN SSRS, I am trying to find any records for which the associated date (shown as adm.ts in the code below) is anytime between 4:00 PM on the previous day and the time the report is run. I have tried the following code (in which I combined DateAdd() with TimeSerial()), but the expression returns '#Error':

=CountDistinct
   (IIf(Fields!adm_ts.Value > (DateAdd("d",-1, Today()) + TimeSerial(16,0,0)),
    Fields!vst_ext_id.Value, 
    Nothing), 
"HRTS_data")

I have also looked into using DateDiff() instead of DateAdd(), but was not successful there either. Any suggestions would be appreciated.


Solution

  • Try this instead: DateAdd("h", 16, DateAdd("d", -1, Date))