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
Anonymous
Not applicable

Sort slicer by another column

Hello,
I created a slicer for filtering my table.

slicerMeasure = DISTINCT(myTable[ProductCode])
and then a column based on slicerMeasure
slicerMeasureColumn = slicerMeasure
then I put slicer element and in section:"Filters on this visual" I added slicerMeasureColumn

 

Its work but I want that the items in my slicer are sorting by another (Date) column in my table.
So like this:
slicerMeasure = DISTINCT(myTable[ProductCode]) ORDER BY DateColumn

How can I do it?

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

Hi, @Anonymous ;

You could  sort slicer columns by which column you wish to sort. I tested it:

1.course column sort by Index column.

vyalanwumsft_0-1649214463378.png

2.sort by

vyalanwumsft_1-1649214551151.png

The final output is shown below:

vyalanwumsft_2-1649214574375.png

Or Can you post sample data  and expected output?
Best Regards,
Community Support Team _ Yalan Wu
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

4 REPLIES 4
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

You could  sort slicer columns by which column you wish to sort. I tested it:

1.course column sort by Index column.

vyalanwumsft_0-1649214463378.png

2.sort by

vyalanwumsft_1-1649214551151.png

The final output is shown below:

vyalanwumsft_2-1649214574375.png

Or Can you post sample data  and expected output?
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi, Thank for your answer.
And it is possible that I sorting "DProdukt REF" for example by a column date from Sales ?

If you create a Calendar Table, which is sorted chronologically, you use the fields from this Calendar table and they will be sorted accordingly.

Or do you mean that the actual items in the slicer are sorted by dates from the sales table? If so, it can be done, but it won't be dynamic. 

In my example, I created the slicer table using:

Sorted Slicer =
ADDCOLUMNS (
    VALUES ( Sales[Product REF] ),
    "Order",
        CALCULATE (
            MAX ( Sales[date] ),
            FILTER ( Sales, Sales[Product REF] = EARLIER ( Sales[Product REF] ) )
        )
)

You can then sort the Product Ref column by the "order" column (which is sorted in ascending order as a date)

sort by column.jpg

 

 

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






PaulDBrown
Community Champion
Community Champion

I'm not too sure what you are after. Normally when you create a table to use as a slicer, you create a relationship between this slicer table and the corresponding field in your fact table. If you are working with dates it is also recommended that you create a date table. Here is an example:

model.jpg

 

You then use the fileds from these tables for you slicers, visuals, filters and measures. The relationship will filter the rows to show thos selected in the slicer.

Result.jpg

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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