Weeknum
determine the week number of a given date in the year.
The WeekNum()
function in Power FX is used to determine the week number of a given date in the year.
It allows you to track what week a date falls into, which is useful for reporting, scheduling, and other time-based calculations.
Syntax
ThisItem.Date
: A column contains the date data for which you want to determine the week number.StartOfWeek.[Weekday]
: Specifies which day of the week to treat as the start day.
By default, it treats Sunday as the first day of the week. But you can use the StartOfWeek enumeration:
StartOfWeek enumeration | Description |
---|---|
| Numbers 1 (Sunday) through 7 (Saturday). Default. |
| Numbers 1 (Monday) through 7 (Sunday). |
| Numbers 0 (Monday) through 6 (Sunday). |
| Numbers 1 (Tuesday) through 7 (Monday). |
| Numbers 1 (Wednesday) through 7 (Tuesday). |
| Numbers 1 (Thursday) through 7 (Wednesday). |
| Numbers 1 (Friday) through 7 (Thursday). |
| Numbers 1 (Saturday) through 7 (Friday). |
Examples
Date | WeekNum( Date ) | WeekNum( Date, StartOfWeek.Wednesday ) |
---|---|---|
Friday, January 1, 2021 | 1 | 1 |
Saturday, January 2, 2021 | 1 | 1 |
Sunday, January 3, 2021 | 2 | 1 |
Monday, January 4, 2021 | 2 | 1 |
Tuesday, January 5, 2021 | 2 | 1 |
Wednesday, January 6, 2021 | 2 | 2 |
Thursday, January 7, 2021 | 2 | 2 |
Saturday, December 25, 2021 | 52 | 52 |
Sunday, December 26, 2021 | 53 | 52 |
Monday, December 27, 2021 | 53 | 52 |
Tuesday, December 28, 2021 | 53 | 52 |
Wednesday, December 29, 2021 | 53 | 53 |
Thursday, December 30, 2021 | 53 | 53 |
Friday, December 31, 2021 | 53 | 53 |
Last updated