The SSRS Weekday function is a Date and Time function that will return the integer value representing the day of the week number (1 to 7) from the given DateTime field. The syntax of the Weekday function to print the day of the week integer is as shown below.
=Weekday(Fields!OrderDate.Value, 0)
=Weekday(Fields!OrderDate.Value, FirstDayOfWeek.System)
By default, the second argument is to set the first day of the week and 0 = Sunday and 6 = Saturday). To demonstrate the SSRS Weekday function, we use the Employee table below, which has 15 records. The image shows the records in the Table report.
SSRS Weekday function Example
For this, let me add a new column to the right side of the Hire Date column and name it the Weekday. Next, right-click the textbox under Weekday and choose Expression. To understand the report, I suggest you refer to the articles on charts, tables, grouping, and format tables in SSRS.
It opens the following expression window to set the time to midnight. The below SSRS Weekday function returns the day of the week number from the HireDate column, where the week starts on Sunday and ends on Saturday.
Both return the same result because Sunday is the system’s default first day of the week.
=Weekday(Fields!HireDate.Value, 0)
=Weekday(Fields!HireDate.Value, FirstDayOfWeek.System)
Let me create another column to set the start day as Monday and find the weekday. For more functions >> Click Here!
=Weekday(Fields!HireDate.Value, FirstDayOfWeek.Monday)
Please click the preview tab to see the SSRS Weekday function report. If you consider the HireDate of the first Emp ID = 1/28/2006, it means Saturday. As the day starts on Sunday in the first example, it returns 7 (1 = Sunday), and for example 2, it starts from Monday, so 6 (7 = Sunday).