Home > Software design >  Parameter Date of SSRS Visual Studio
Parameter Date of SSRS Visual Studio

Time:06-03

I need help on developing the expression for a parameter. What i need is: That the report gives me data of the day before when it´s Tuesday, Wednesday, Thursday and Friday, and when it´s Monday that it gives me the data of the 3 days before (of Friday, Saturday and Sunday). How can i put that in an expression of the Parameter?

CodePudding user response:

I usually have the date parameter that checks the current date and if it's Monday, subtract the extra two days.

=TODAY.AddDays(0 - IIF(TODAY.DayOfWeek.ToString = "Monday", 3, 1))

Then the query would use this as the starting date range and yesterday as the end.

WHERE MY_DATE BETWEEN @START_DATE AND CAST(GETDATE() - 1 AS DATE)

If the Date field has a timestamp then you'd need to convert that to a date.

WHERE CAST(MY_DATE AS DATE) BETWEEN @START_DATE AND CAST(GETDATE() - 1 AS DATE)
  • Related