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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
JustinDoh1
Post Prodigy
Post Prodigy

How to sort Month under Year hierarchy

I am attaching my Pbix file here.

 

I am trying to order month in descending order (in a slicer).

Example:

Feb --> Jan for 2022

Dec --> Nov --> Oct ... --> Jan for 2021.

This is what I have now:

JustinDoh1_1-1647478613321.png

 

Year is fine (as I selected this).

JustinDoh1_0-1647479972804.png

 

I spent a lot times trying to create a date hierarchy, and by watching one YouTube, I was able to create Hierarchy at Model mode like this:

JustinDoh1_0-1647478420708.png

I am not sure whether this is the best approach because I thought I could just create a date hierarchy if the data type is DATE, but it seems to be little tricky.

 

Now, one issue that I am having is, when I try Sort by column (using "Date"), I am getting "Circular Dependency" error (so something is messed up).

JustinDoh1_2-1647478799673.png

 

I think creating a separate Calendar table and using that would be an ideal, but now, output (Amount) comes from Data table, so I am not sure how to make it work.

JustinDoh1_3-1647479606770.png

 

 Thank you.

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@JustinDoh1 , Create two columns in your table

 

Month1 = FORMAT([Date],"mmm")
Month1 sort = month([DAte])

Month Rank = RANKX(ALL('Date'),'Date'[Month Year Sort],,DESC,Dense)

 

Sort month1 on month Rank and use that in visual

 

How to Create Sort Column and Solve Related Errors:
https://www.youtube.com/watch?v=KK1zu4MBb-c

View solution in original post

2 REPLIES 2
JustinDoh1
Post Prodigy
Post Prodigy

@amitchandak 

Thank you Amit for your help.

This is little bit complex than I thought.

I will learn one tip at a time. 

amitchandak
Super User
Super User

@JustinDoh1 , Create two columns in your table

 

Month1 = FORMAT([Date],"mmm")
Month1 sort = month([DAte])

Month Rank = RANKX(ALL('Date'),'Date'[Month Year Sort],,DESC,Dense)

 

Sort month1 on month Rank and use that in visual

 

How to Create Sort Column and Solve Related Errors:
https://www.youtube.com/watch?v=KK1zu4MBb-c

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.