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
SDSolutions
Frequent Visitor

Control Sort order of Class Hierarchy in a Slicer

hello,

 

I have a farily complex star schema model that requires a slicer with a hierarchy.

 

The problem: I want my slicer have the same ordering of each level in the hierarchy. Each level of the hierarchy is defaulting to alphabetical sorting in the slicer, except for the lowest, Class, which is sorted by the Sort column.

 

The dummy dimension is as follows:

SortClassClass GroupClass Region Class Portfolio
1TimLamb ClassBaby Animal

 Class Portfolio 1

2SunnyLamb ClassBaby AnimalClass Portfolio 1
3SueLamb ClassBaby AnimalClass Portfolio 1
4BoydChicken ClassAnimalClass Portfolio 1
5FallonChicken ClassAnimalClass Portfolio 1
6DaisyBeef ClassAnimalClass Portfolio 1
7StewartBeef ClassAnimalClass Portfolio 1
8OnionVegetable ClassVegetableClass Portfolio 2
9PepperVegetable ClassVegetableClass Portfolio 2

 

The issue I have is that the slicer alphabetically sorts the Group, Region, and Portfolio columns, but i want them all to be sorted via the sort column. However when I try this, I get an error message that says there can't be more than one value in the (Class group, Class Region, Class Portfolio) column for each value in the sorting column...


I have tried this sqlbi custom sorting solution located here:
https://www.sqlbi.com/articles/sorting-duplicated-names-in-a-level-of-a-hierarchy-with-dax/
But this does not produce the result that I want and creates multiple values at each level.

I also tried a snowflake arrangement for each level of the hierarchy. But I am not sure this is the right approach as i was not able to create a single hierarchical slicer.  

All I want is for each level of the slicer to have one value and each of those values to be sorted with the same ordering as the underlying Class sort. 
My desired output would have each level of the slicer look something like this (i.e matching the order of the underlying sort):

 

Slicer:

  1. Class Portfolio 1
    1. Baby Animal
      1. Lamb Class
        1. Tim  (1)
        2. Sunny (2)
        3. Sue (3)
    2.  Animal
      1. Chicken Class
        1. Boyd (4)
        2. Fallon (5)
      2. Beef Class
        1. Daisy (6)
        2. Stewart (7)
  2. Class Portfolio 2
    1. Vegatable
      1. Vegetable Class
        1. Onion (8)
        2. Pepper (9)

 

 

Any suggestions would be greatly appreciated.

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @SDSolutions ,

 

Each class column needs to have its own sort column. You current sort colum applies only to Class but when applied to Class Group or Class Region it will cause an error because a unique item in either of these columns, take Lamb Class as an example, has more than one sort numbers (1,2,3) which is ambiguous.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

2 REPLIES 2
SDSolutions
Frequent Visitor

Turns out there was some erroneous data in the source data preventing the sorting from occurring. Thanks for your help.

danextian
Super User
Super User

Hi @SDSolutions ,

 

Each class column needs to have its own sort column. You current sort colum applies only to Class but when applied to Class Group or Class Region it will cause an error because a unique item in either of these columns, take Lamb Class as an example, has more than one sort numbers (1,2,3) which is ambiguous.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.