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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
sw123
Helper III
Helper III

Problems with week number

Hi,

 

I have a date table with a week year column like this:

 

"Week year", YEAR([Date]) & " "& WEEKNUM([Date], 21)
 
In our calender (ISO 8601) Januari 1st and 2nd 2022 is part of week 52 2021. My date calender sets Januari 1st and 2nd to week 52 2022, which is of course totally wrong. How can I fix this?
 
Thanx in advance!
1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

Hi @sw123 ,

 

Try this:-

Column =
VAR week_num =
    1+ INT (
            DIVIDE (
                (
                    [Date] - WEEKDAY ( [Date], 16 ) + 1
                )
                    - ( DATE ( YEAR ( [Date] ), 1, 1 ) ),
                7
            )
        )
RETURN
    "Week year " & YEAR ( [Date] ) & " " & week_num

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

2 REPLIES 2
Samarth_18
Community Champion
Community Champion

Hi @sw123 ,

 

Try this:-

Column =
VAR week_num =
    1+ INT (
            DIVIDE (
                (
                    [Date] - WEEKDAY ( [Date], 16 ) + 1
                )
                    - ( DATE ( YEAR ( [Date] ), 1, 1 ) ),
                7
            )
        )
RETURN
    "Week year " & YEAR ( [Date] ) & " " & week_num

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

ALLUREAN
Solution Sage
Solution Sage

Hi, @sw123 

 

Try this calendar dax script (you need to play with the iso parameters also):

https://www.dropbox.com/s/qo20q59mbsz60av/Custom%20Calendar%20%28ISO%2C%20445%2C%20etc%29.txt?dl=0

or this can be also helpful:

https://blog.gbrueckl.at/2012/04/iso-8601-week-in-dax/

 

 




Did I answer your question? Mark my post as a solution!


https://allure-analytics.com/
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.