Kashyap MNVL Kashyap MNVL - 1 year ago 92
SQL Question

SSRS Parameter expression to select hours range dynamically

I am currently working on an SSRS report and I have to deliver this report two times a day. (At 12 PM and 12 AM). The report has the following parameters.
Date: (Picks Today's Date)
Beg Hour: (Defaults to 8 i.e. 8AM)
End Hour: (Defaults to 18 i.e. 6PM)

When the report first delivers between 12PM to 12:30 PM (Afternoon) Monday, I want the BegHour parameter to set to 8 and EndHour to set to 12.
When the report again runs for the second time between 12AM to 12:30 AM (Tuesday morning) to, I want the BegHour to set to 8 and EndHour to 18.

I tried using IIF or CASE statements by passing today as paramter to date functions. But I am having trouble figuring this out.
Any help is greatly appreciated.
Thank You.

Answer Source

I think you can set BegHour to 8 by default, since in both cases it is required it to be set to that value.

For EndHour you can use the following expression:

Now.Hour = 0, 18, 12

Let me know if this helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download