'PowerBI - Convert Date to the WeekNumber of the Month
Date WeekNum Month Year
5/2/2018 Week 1 May 2018
6/1/2018 Week 1 June 2018
How would you get the WeekNum from the Date? The WeekNumber needs to be week number of the particular month and not the Year.
Solution 1:[1]
One approach would be to take the day of the month and divide by seven:
WeekNum = ROUNDUP(DIVIDE(DAY(TableName[Date]), 7), 0)
Solution 2:[2]
You can use the next formula
1 + WEEKNUM(usage_users[row_date]) - WEEKNUM(STARTOFMONTH(usage_users[row_date]))
This gives you the number of the week.
Solution 3:[3]
basically you need to use STARTOFMONTH and WEEKNUM together:
Here is a good video explaining it also:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alexis Olson |
| Solution 2 | blackgreen |
| Solution 3 | Theo |
