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

How can I add custom sort on Hierarchy Slicer in powerbi

Dimensions = {
    ("Date", NAMEOF('table'[DATE]), 0,"Date"),
    ("Week", NAMEOF('table'[WEEK_START]), 1,"Date "),
    ("Month", NAMEOF('table'[DATE_B].[Month]), 2,"Date"),
    ("Advertiser ID", NAMEOF('DIM'[ADVERTISER_ID]), 3,"Platform"),
    ("Advertiser", NAMEOF('DIM'[ADVERTISER_NAME]), 4,"Platform"),
     }
This is the sample of parameter I am using to create slicer where  "Value 4" and "Value 1" are used in values field to create a slicer and it is showing Date options first and then Platform and so on.
 
I want to show "Platform" first and then "Date" right now it is showing alphabetically
 
 
 
 
1 ACCEPTED SOLUTION

Hi @jaspreet27singh ,

Based on my understanding of your requirement, what you is a order-by column for column 'Dimensions'[Value4] as described here: Sort one column by another column in Power BI - Power BI | Microsoft Learn

To create the sort-by column, you can create a calcualted column in table 'Dimensions':

 

SortValue4 = IF([Value4]="Date Dimensions",2,1)

Kind regards,

Martin

View solution in original post

6 REPLIES 6
v-yaningy-msft
Community Support
Community Support

Hi, @jaspreet27singh 

First, thanks for @Martin_D  reply. The display order in the slicer is really affected by the parameter after NAMEOF, which you can modify to display the desired order.

vyaningymsft_0-1713764632387.png


Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

Martin_D
Super User
Super User

Hi @jaspreet27singh ,

 

The bold numbers (see below) in your field parameter table define the display order. If you want to change the order, you can change the numbers. But be careful, each number should be unique in this column.

Dimensions = {
    ("Date"NAMEOF('table'[DATE]), 0,"Date"),
    ("Week"NAMEOF('table'[WEEK_START]), 1,"Date "),
    ("Month"NAMEOF('table'[DATE_B].[Month]), 2,"Date"),
    ("Advertiser ID"NAMEOF('DIM'[ADVERTISER_ID]), 3,"Platform"),
    ("Advertiser"NAMEOF('DIM'[ADVERTISER_NAME]), 4,"Platform"),
     }
 
Kind regrads,
Martin

Hi @Martin_D,

It is not working as you mentioned above 

Dimensions = {
    ("Date"NAMEOF('table'[DATE]), 0,"Date"),
    ("Week"NAMEOF('table'[WEEK_START]), 1,"Date "),
    ("Month"NAMEOF('table'[DATE_B].[Month]), 2,"Date"),
    ("Advertiser ID"NAMEOF('DIM'[ADVERTISER_ID]), 3,"Platform"),
    ("Advertiser"NAMEOF('DIM'[ADVERTISER_NAME]), 4,"Platform"),
("Brand", NAMEOF('DIM'[BRAND]), 5,"Brand"),
    ("Product Name", NAMEOF('DIM'[PRODUCT_NAME]), 6,"Brand")
     }

using this and it is showing Brand on top then Date and Platform.
powerbi.png
   

Hi @jaspreet27singh ,

 

Would you like to provide the following information to help understanding what you want?

 

  • The pbix file, including the field parameter and the slicer
  • A full screenshot, including the slicer with all levels expanded, the slicer's field configuration in the "Build" pane of Power BI Desktop and the "Data" pane of Power BI Desktop, and annotations what is wrong for you
  • A drawing of what you want to see?

Thank you!

 

Kind regards,

Martin

Hi @Martin_D ,

I am sharing all possible screenshot below.

 

By default "Date Dimension" is coming fisrt if you see slicer screenshot and requirement is to sort as per user requirement for example Platform first then Date

 

horizontally and vertically does'nt not work here because we have more in list 

 

 

slicer parameterslicer parameterThis one is fields I am using to create slicerThis one is fields I am using to create slicerslicerslicerData partData part

Hi @jaspreet27singh ,

Based on my understanding of your requirement, what you is a order-by column for column 'Dimensions'[Value4] as described here: Sort one column by another column in Power BI - Power BI | Microsoft Learn

To create the sort-by column, you can create a calcualted column in table 'Dimensions':

 

SortValue4 = IF([Value4]="Date Dimensions",2,1)

Kind regards,

Martin

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.

Top Solution Authors