0
votes

In my report I want to populate date parameter automatically. on daily bases date need to be select previous day (today()-1) , but on Monday it need to select Friday date.

please help me to write a function around this

I have date parameter in my report.

1

1 Answers

1
votes

You can achieve this using Weekday(). Make sure the parameter has the Date/Time data type, and use this expression as the default value:

=DateAdd(DateInterval.Day, 
IIF( Weekday(Today(),0) = 1, -3, -1), 
Today())

The function Weekday(Today(),0) will equal 1 when today's date is a Monday. If true, you subtract three days from today's date to get the previous Friday. If not, you subtract 1 to get yesterday.