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 September 15. Request your voucher.

Reply
CornelisV
Helper III
Helper III

Create an calendar table with only Year - Week numbers

Dear all,

 

Could you please demonstrate me how to create an alternaticv Calender table with only Year and Week numbers:

So...

Year    Weeknumber

2024   51

2024   52

2025   01

2025   02

2025   03

.. and so on.

 

Best regards,

 

Cornelis

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@CornelisV Try this:

 

Calendar Table = 
  VAR __BaseTable = CALENDAR( DATE( 2024, 1, 1), DATE( 2025, 12, 31 ) )
  VAR __Table = 
    ADDCOLUMNS(
      __BaseTable,
      "Year", YEAR( [Date] ),
      "WeekNumber", WEEKNUM( [Date] )
    )
  VAR __Result = DISTINCT( SELECTCOLUMNS( __Table, "Year", [Year], "Weeknumber", [WeekNumber] ) )
RETURN
  __Result

 



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...

View solution in original post

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@CornelisV Try this:

 

Calendar Table = 
  VAR __BaseTable = CALENDAR( DATE( 2024, 1, 1), DATE( 2025, 12, 31 ) )
  VAR __Table = 
    ADDCOLUMNS(
      __BaseTable,
      "Year", YEAR( [Date] ),
      "WeekNumber", WEEKNUM( [Date] )
    )
  VAR __Result = DISTINCT( SELECTCOLUMNS( __Table, "Year", [Year], "Weeknumber", [WeekNumber] ) )
RETURN
  __Result

 



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...

Thank you for your help!

Deku
Super User
Super User

I would suggest having a full calender table, but convert the weeks I assume you have in your fact table to date. These dates could be start of end of week. This will mean you can still use time intelligence functions


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Hi @Deku ,

 

Thank you. A full Calendar table is the best, but I have only data with weeknumers, not date 😐

 

Best regards

Cornelis

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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