0

I have a report that I need to set-up a default date for @Star and @End date parameter to Last Sunday for @Start and Last Saturday for @End. Found the code to Last Day of previous week (Sunday) =DateAdd(DateInterval.Day, -0,DateAdd(DateInterval.Day, 1-Weekday(today),Today)), but unable to find expression for the Saturday. I tried to modify the (Monday) =DateAdd(DateInterval.Day, -6,DateAdd(DateInterval.Day, 1-Weekday(today),Today)), but giving a different result.

Arsee
  • 651
  • 2
  • 11
  • 36
  • For Sunday you can make your expression more simple since DateAdd 0 days change nothing: DateAdd(DateInterval.Day, 1-Weekday(Today()),Today()) – niktrs Jun 16 '17 at 11:56
  • I think that by setting start date as last Sunday and end date as last Saturday your query will always return an empty result set since the start date will be after the end date. – niktrs Jun 16 '17 at 12:02

1 Answers1

1

Expression for last saturday

=DateAdd(DateInterval.Day, -1,DateAdd(DateInterval.Day, 1-Weekday(today),Today))

SuperSimmer 44
  • 964
  • 2
  • 7
  • 12