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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Shahzad
New Member

How to create Year, Month, Date hierarchy while creating reports in Power BI

Hi All,

 

 

I have created a report in power BI, this has seperate month and year fields in a period dimension. but i have difficulties in making a hierachy for it. eg: year 2016 month January or year 2016 month February, also to do a month on month comparison.

 

Can you tell me if their is a possibility of doing so, and how it can be done.

 

Thanks in Advance!.

 

BR,

 

Shahzad

7 REPLIES 7
Shahzad
New Member

Hi,

 

As of now this is how the dataset looks;

 

Anonymous
Not applicable

Hi @Shahzad,

Have you omitted the screenshot? We are not able to view the dataset you post.

Thanks,
Lydia Zhang

tschmidt87
Advocate I
Advocate I

@Shahzad

Get the HierarchySlicer from the Custom Visuals Gallery: https://app.powerbi.com/visuals/show/HierarchySlicer1458836712039

 

Add it, make sure the data field is of type "Date" and it should work as below:

 

hierarchyslicer.png

 

You can remove certain hierarchy levels, such as "Quarter" so it only lists every month of the Year below '2016'

Anonymous
Not applicable

Hi @Shahzad,

What is the exact error message or problem you get when creating Date hierarchy?

Firstly, you don’t have to create hierarchy. You can achieve identical functionality by adding multiple columns(Year, Month)  to the "Axis" of a bar or column chart. This way, the chart will also enable you to dill down the data.

Secondly, you are able to create Date table using M query or DAX expressions in Power BI Desktop. For more detailed steps, please review the following blogs.

http://www.agilebi.com.au/power-bi-date-dimension/
http://kohera.be/blog/business-intelligence/how-to-create-a-date-table-in-power-bi-in-2-simple-steps...


Thanks,
Lydia Zhang

ankitpatira
Community Champion
Community Champion

@Shahzad in power bi desktop via query editor, make sure first both columns year and month are of type text. then create custom column as shown below and change type of that custom column to date. then simply use that custom column for your visuals which will give you year month hierarchy.

 

Capture.PNG

Hi @ankitpatira ,

 

I have a similar requirement where I've some sales data with the year as one of the columns. The data can be seen in the below table.

DateSalesYear
2020-01-01102020
2020-01-02122020
2019-01-045.92019

 

Now, the requirement is to create a slicer for the year such as FY2020, FY2019, etc.

Following the steps described by you, I've created a custom column i.e. FY = "FY"&[Year] but not able to change its data type to date.

DateSalesYearFY
2020-01-01102020FY2020
2020-01-02122020FY2020
2019-01-045.92019FY2019

 

Once, I change the data type to 'date', all the values in the column FY change to 'Error'.

 

Can you please help me?

For creating the slicer you don't need to convert the slicer to date type. You can use the column in text format only for slicer.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

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