Forum Discussion
Week number not matching date
- 5 years ago
Try this formula:
YearWeek = RIGHT(IF(WEEKNUM('Calendar'[Date], 21)=53 && MONTH('Calendar'[Date])=1, YEAR('Calendar'[Date]) -1, YEAR('Calendar'[Date])),2) & WEEKNUM('Calendar'[Date], 21)
If you want to use a Iso YEAR Week the formula should be like this:
YearWeek = IF(WEEKNUM('Calendar'[Date], 21)=53 && MONTH('Calendar'[Date])=1, YEAR('Calendar'[Date]) -1, YEAR('Calendar'[Date])) & "-" & WEEKNUM('Calendar'[Date], 21)
You need to put another parameter in weeknum function.... the parameter with value 21.
See also link below:
https://community.powerbi.com/t5/Desktop/Looking-for-real-year-week/m-p/1591530#M646306
Hello,
Thanks for your answere. It seems to work. Although is it possible to show YYWW instead of YYYY-WW?
Kind Regards
- themistoklis5 years agoCommunity Champion
Try this formula:
YearWeek = RIGHT(IF(WEEKNUM('Calendar'[Date], 21)=53 && MONTH('Calendar'[Date])=1, YEAR('Calendar'[Date]) -1, YEAR('Calendar'[Date])),2) & WEEKNUM('Calendar'[Date], 21)
- AnnaML5 years agoFrequent Visitor
Thanks for the support, it really helped!