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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.