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

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

Reply
StuartSmith
Power Participant
Power Participant

Reverse WeekNum to convert Calendar week to date

Is there a way, similar to WeekNum, but in reverse and convert Calendar Weeks to Dates?

The Calendar week format coming from the data source is 01.2020.

Thanks in advance.

5 REPLIES 5
Greg_Deckler
Community Champion
Community Champion

Sure, the basic technique is:

 

Date Column = 
  VAR __Year = [Year]
  VAR __Week = [WeekNum]
  VAR __Calendar = 
    ADDCOLUMNS(
      CALENDAR(DATE(__Year  - 1,1,1),DATE(__Year + 1,12,31)),
      "__WeekNum",WEEKNUM([Date])
    )
RETURN
  MINX(FILTER(__Calendar,[__WeekNum] = __Week),[Date])
  


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks, and sorry for the delay in getting back to you. First question, I notice the date column is showing 2019, when it should be 2020.  

2020-04-27_13-13-29.png

 

I had a play with your code and the reason the year is 2019 is because of "-" in the below line, but dont know how to correct.  

 

CALENDAR(DATE(__Year - 1, 1,1),DATE(__Year + 1,12,31)),
 
Also, I would like the calendar week to start in the Monday, but the code is making the week start on the Tuesday.  So as an example C\W 13 should be 23/03/2020 and C\W 15 should be 06/04/2020.
 
Thanks in advance,
 

Does anyoen know why the year is showing 2019, and not the actual year in the column, 2020?  Plus, how to change th calendar week begin date from the Tuesday to the Monday?

 

Anyone?

 

Found an alternative soultion.  

 

ndate = DATE([year],1,-2)-WEEKDAY(DATE([year],1,3))+[week]*7

Just testing now. 

Helpful resources

Announcements
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