ShaunK
ShaunK

Reputation: 1221

What is the SSRS expression for end day of week?

I have the following MSSQL query to return the ending day of the week in MSSQL:

SELECT DateAdd(Day, 0 - DatePart(Weekday, GetDate()), GetDate());

I played around with the =DateAdd function, but it keeps throwing me an error for the Day parameter. Also, when I used DateInterval.Day... I get the same error.

However, when I try placing that query into an SSRS expression, it throws me an error. Does anyone know the direct conversion for that query above in SSRS?

Upvotes: 3

Views: 6982

Answers (1)

Yuriy Galanter
Yuriy Galanter

Reputation: 39777

SSRS Uses a dialect of Visual Basic, its Date functions are different from TSQL, you have to use

  • "d" instead of DAY for day interval
  • "w" instead of WEEKDAY for weekday
  • Now() instead of GetDate() for current date.

Try

=DateAdd("d", 0 - DatePart("w", Now()), Now())

Upvotes: 4

Related Questions