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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
GerardContlx
Regular Visitor

Adding week of year to date hierarchy

Hello everyone,

 

How can I add the year week to the date hierarchy?

 

Sorry I'm amaterur.

1 ACCEPTED SOLUTION

@GerardContlx  Make sure you mark your Date table as a Date table - see my blog here on how to do that: https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html

 

Once you mark it as a date table, that date hierarchy will disappear. You'll then need to re-create it manually and can add Week and any other fields you want to it: 

https://radacad.com/what-a-power-bi-hierarchy-is-and-how-to-use-it 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

4 REPLIES 4
bcdobbs
Super User
Super User

Hi @GerardContlx 

 

You need to build a custom date table.

 

https://www.sqlbi.com/articles/creating-a-simpler-and-chart-friendly-date-table-in-power-bi/

 

Something a long lines of the above but with an extra line which produces a week number:

https://docs.microsoft.com/en-us/dax/weeknum-function-dax

You can then relate the table to your date field to create your hierachy.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

If you share a demo file I can add a date table to it for you.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

GerardContlx_0-1642119107638.png

 

I don´t know hay can I upload the file.

 

@GerardContlx  Make sure you mark your Date table as a Date table - see my blog here on how to do that: https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html

 

Once you mark it as a date table, that date hierarchy will disappear. You'll then need to re-create it manually and can add Week and any other fields you want to it: 

https://radacad.com/what-a-power-bi-hierarchy-is-and-how-to-use-it 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors