0

How to display Last week Sunday and last week Saturday from current date in SSRS ?

In sql server we can find the last week Sunday and last week Saturday from todays date(CurrentDate='19-02-2020') as

select DATEADD(wk, -1, DATEADD(wk, DATEDIFF(wk, 0,getdate()), -1))-- for sunday

select DATEADD(wk, DATEDIFF(wk, 0, getdate()), -2) --for saturday

So how we can write an default expression in the SSRS Parameters?

user2728106
  • 185
  • 2
  • 5
  • 15
  • Have you tried using the `DateAdd`, `DateDiff`, and `Today` functions in SSRS? When you write an expression, there are examples included on the bottom half of the screen if you click on a function. – StevenWhite Feb 19 '20 at 17:47
  • Does this answer your question? [SSRS Last Week Monday and SUnday](https://stackoverflow.com/questions/22471805/ssrs-last-week-monday-and-sunday) – Chris Albert Feb 19 '20 at 17:53
  • Here the week start from Sunday to Saturday – user2728106 Feb 19 '20 at 18:30

1 Answers1

2

This assumes that the first day of the week is a Sunday, if you configuration is not like this then you will need to adjust the expressions to correct the offset

For Last Saturday use:

=DATEADD(DateInterval.Day, Weekday(Today()) * -1, Today())

For Last Sunday use:

=DATEADD(DateInterval.Day, (Weekday(Today()) -1) * -1, Today())
Alan Schofield
  • 19,839
  • 3
  • 22
  • 35
  • Yeah in this case the First day of week is Sunday and the week is from Sunday to saturday So the above code is as per this configuration. – user2728106 Feb 19 '20 at 18:20