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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
BertrandD
New Member

Sort in a slicer

hello all,

 

Here is my problem. 

I work on "Power BI Desktop" 2.73.5586.1101 64-bit (septembre 2019).

I have a slicer which use a formatted string, composed with an id and a label, as :

"4512 - BANANE"

"4513 - ABRICOT"

"4514 - KIWI"

I want all the string visible in the slicer (the id and the label), but with an order only on the second part alphabetically:

4513 - ABRICOT

4512 - BANANE

4514 - KIWI

 

I have another object composed only with the label, but when I set the slicer, I can only choose one object and only sort it ascending-alphabetically or descending-alphabetically. 

 

How could I do ?

 

Thank a lot 

 

 

1 ACCEPTED SOLUTION

Ok, thanks everyone for your help.

 

I undestand better my issue.

I want to use just a attribute (a single column) from a table "Products" for a slicer, but I didn't create first a table for this attribute.

I think I should first create the table for the attribute with id and label as columns, and after it will be possible to use differents columns of the new table for the slicer.

 

B.

View solution in original post

8 REPLIES 8
AlB
Super User
Super User

Hi @BertrandD 

If you have another column with only the labels, you can use that one to sort. Check this out for details:

https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column

 

ChrisMendoza
Resident Rockstar
Resident Rockstar

@BertrandD -

You should be able to accomplish using Sort by Column.

bi1.pngbi2.png






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Hi Chris,

 

Thanks for help.

When I select my slicer, the "Sort by Column" button is disabled (grey).

And in the "Field"/"Champ" for the slicer, I can only put one object, (the id or the label), not both.

 

Hello @BertrandD ,

 

they created another column to use only for order.

You will still use you orig column but you need to sort it by the new column.

 

As you are saying, the Sort by Column is Gray and is disabled,

you can click any column then select your slicer column again and the sort by column is clickable now.

 

Hope this helps.

Mussaenda,

I'm sorry but I'm a newbie with Power BI.

Smiley Frustrated

 

I didn't solve my problem despite your explanations...

Let's better describe my situation.

I have a dataset called Fiche-Produit-Type (see screenshot).

In this dataset, I created the columns :

"Code activité" (id1), "Lib activité" (label1), and "Activité" (composed by id1 and label1)

"Code Groupe" (id2), "Lib Groupe" (label2), and "Groupe" (concatenation of id2+label2)

 

And I use two slicers for my graphics :

A slicer to choose the "Activité", and a slicer to choose the "Groupe".

 

But for my slicer "2" ("Groupe"), I don't find the way to associate to it the column "Lib Groupe" (label2).

Even when I select the column Lib Groupe, with my slicer selected, and I click on "Sort by column", nothing happens :

The slicer is still sorted by "Groupe" and not by "Lib Groupe".

 

And if I click on the 3 little dots on the above-right of the slicer, I don't have any choice for the columns on which I could sort.

 

Thanks

 

 Capture.JPG

Hi @BertrandD ,

 

As what @ChrisMendoza  said,

you can find the sort by column on the modelling tab. and then you can see there the choices.

 

I think this video will help you understand more.

 

Ok, thanks everyone for your help.

 

I undestand better my issue.

I want to use just a attribute (a single column) from a table "Products" for a slicer, but I didn't create first a table for this attribute.

I think I should first create the table for the attribute with id and label as columns, and after it will be possible to use differents columns of the new table for the slicer.

 

B.

You need to go into the table/data view, click in the column to be sorted, click "sort by column" and then select the surrogate sort column".

https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column#sort-using-the-sort-by-column-butto...

 

So, select your original field in the fields section, and from the modelling tab, choose Sort by column and pick another field (label) to use that field when sorting the original field.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.