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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

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
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

Top Solution Authors