Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I am looking to sort my Slicer value according to the numeric field ( Not ascending or descending).
For example below country is sorted based on alphabets in a table but the requirement is in the slicer country should be sorted based on population.
Canada should come first
Then Australia
Then India
and Then US
f
How to achieve this?
Thanks in advance.
Zeenat
hi, @Anonymous
For your case, you could use this way as below:
Step1:
Add a dim country table that contains the order column
Step2:
Then create a relationship with fact table by Country column
Step3:
Then use Sort by column for dim table:
https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column
https://radacad.com/sort-by-column-in-power-bi
Step4:
When create the report, use country column from Dim country table as a slicer and Country from fact table in other visual.
and here is sample pbix file, please try it.
Regards,
Lin
Did you hard coded the values in DIm_Table where we have all countries? I cant take hard coding as in actual data is in trillions.
Also, Sort by Column should have a single value for each country but my actual data look like this
hi, @Anonymous
For the dim country table, you could Duplicate the fact table and then Group By it, and then add a conditional column for sort column in edit queries.
Either way, you need to define the rules in advance.
Regards,
Lin
Hello Lin,
I have created a column
1Rank = RANKX(FILTER('Time','Time'[Region M3]=EARLIER('Time'[Region M3])),'Time'[Actual],,DESC,Dense)
but when I am trying to sort my column Region M3 based on 1Rank, I am getting this error
Can you help? I am trying to sort the values in Slicer for Region M3 and Market M15 though they are not getting used in any visuals.
You would need to have a 1to1 mapping from Region M3 to Rank1
Is there any way to achieve it? as per my knowledge data is vast and there are multiple region_M3 and market_M15 and aggregation is an issue.
It will depend on your table structure, but you could do this:
Country | Population | Order |
Australia | 4797400 | 2 |
Canada | 7964900 | 1 |
India | 4217600 | 3 |
US | 3839600 | 4 |
Then use the Sort By Column on the modeling tab
This will sort the countrys by the sort order ascending
This will work if I have to sort in the table, but I want to values to be sorted in the Slicer, so it doesn't solve the purpose OR I am unable to understand your solution, could you elaborate.
It works for slicer ordering to. Below is the one im currently working on. You can see these are sorted descending, not ascending like default
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
72 | |
38 | |
31 | |
27 |
User | Count |
---|---|
92 | |
50 | |
44 | |
40 | |
35 |