Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
AnnaML
Frequent Visitor

Week number not matching date

Hello, 

 

I have an issue with week numbers. I have created a column called YearWeek using the following: 

YearWeek = IF(WEEKNUM([Date].[Date])<10,FORMAT([Date],"YY0WW"),FORMAT([Date],"YYWW"))
 
I put date and yearweek into a table and got the following:
 
 
 

yearweek.png

My issues is that the weeks does not match the right dates. For example in this table it shows that week 3 is between 10-16 of January but in reality it's between 17-24 January. I want week 1 to start with January 3rd. 

Can someone please help me? 

 

Thankful for support, 

1 ACCEPTED SOLUTION

@AnnaML 

 

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)

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hello, how about if I want the week number only, WW?

Thank you.

themistoklis
Community Champion
Community Champion

@AnnaML 

 

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

@AnnaML 

 

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)

Thanks for the support, it really helped! 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors