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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
YunJ
Post Prodigy
Post Prodigy

How to sort the slicer which is from the table made by DAX?

Hi,

 

I use DAX to make a dimension table as following as my slicer. But I'm wondering how to sort when showing as the slicer?

 

YunJ_0-1630484262472.png

 

YunJ_1-1630484295051.png

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @YunJ ,

If you use the original column to sort by the Index column created with Dax, it will produce a circular dependency.

vyangliumsft_0-1631087092517.png

https://community.powerbi.com/t5/Desktop/Circular-dependancy-error-creating-relationship/m-p/415732

Can you consider Create calculated table, and then sort by the new columns [Beauty Category] and [Index] in Table2.

Table 2 =
SUMMARIZE('Table','Table'[Beauty Category],"Index",
SWITCH(
    TRUE(),
    'Table'[Beauty Category]="Hair",1,
    'Table'[Beauty Category]="Makeup",3,
    'Table'[Beauty Category]="Female Skincare",4,
    'Table'[Beauty Category]="Men",2))

vyangliumsft_1-1631087092519.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

10 REPLIES 10
v-yangliu-msft
Community Support
Community Support

Hi  @YunJ ,

If you use the original column to sort by the Index column created with Dax, it will produce a circular dependency.

vyangliumsft_0-1631087092517.png

https://community.powerbi.com/t5/Desktop/Circular-dependancy-error-creating-relationship/m-p/415732

Can you consider Create calculated table, and then sort by the new columns [Beauty Category] and [Index] in Table2.

Table 2 =
SUMMARIZE('Table','Table'[Beauty Category],"Index",
SWITCH(
    TRUE(),
    'Table'[Beauty Category]="Hair",1,
    'Table'[Beauty Category]="Makeup",3,
    'Table'[Beauty Category]="Female Skincare",4,
    'Table'[Beauty Category]="Men",2))

vyangliumsft_1-1631087092519.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

@v-yangliu-msft  Thanks for your solution. It really helps!

v-yangliu-msft
Community Support
Community Support

Hi  @YunJ ,

You can enter the Power query to customize the sort order of the specified columns

1. Add Column – Column From Examples – From Selection

vyangliumsft_0-1630992266502.png

2. Custom order rules

vyangliumsft_1-1630992266504.png

3. Select the column [Beauty Category], Column tools – Sort by column – [Custom]

vyangliumsft_2-1630992266506.png

4. Result.

The sorting of slicers also changes.

vyangliumsft_3-1630992266508.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yangliu-msft 

I cannot find my table in power query because it is a table written by DAX.

Thanks

 

mussaenda
Super User
Super User

Hi @YunJ ,

 

you can add an index column and sort your column according to the index.

 

Hope this helps

Hi, May I ask how to add an index column at this situation?

Hi @YunJ ,

 

Try the idea from the attached pbix.

 

Hope this helps2021_09_07_08_45_46_Window.png

 

Hi @mussaenda 

 

Thanks for your reply. 

 

In your way I can only use the "column" column as a slicer. I'm wondering is there a way I can use the original "Beauty Category" as my slicer? (Because I already use this column to make relationship and create many measures and visualizations.) 

YunJ_0-1631009404249.png

 

Pragati11
Super User
Super User

HI @YunJ ,

 

The slicers get sorted by themselves. Like in the case above, your slicer is sorted in alphabetical order.

Do you want to sort them in a custom order apart from this default alphabetical order?

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hi @Pragati11 I want to sort them in a custom order.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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