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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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.










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


Proud to be a Super User!









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










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


Proud to be a Super User!









"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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.