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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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