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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
kaf_617
Regular Visitor

Stop a slicer function from auto sorting my y-axis variables order

I have the following slicer sorting challenge. Everytime I change the year from 1990, 2000, 2010, 2020, the city/location names on the y-axis auto sort... I dont want that to happen. I want them all to stay in the same order as they are currently in 1990. How can I do that? Step by step please 🙂

 

kaf_617_0-1716323488210.png

 

1 ACCEPTED SOLUTION
kpost
Super User
Super User

This solution is generalizable to many different situations where you want to force visuals to sort a certain way that cannot be done by Power BI because it is not alphabetical or increasing numerically etc.  I do it all the time.

 

Create a new table with two columns.

 

Column1:  City Name (contains all the cities, spelled exactly the same as they are spelled in your fact table)

Column 2:  Sort Order (Numerical values corresponding to the order you want them in the visual)

 

Then, open up this new table in Table View, click City Name, and sort by column "Sort Order"

sort.PNG

 

Open "Model View", and create an active many to one relationship between the City Name column in this new table and the City Name column in your fact table.

 

Use the City Name column from your newly created Dimension table in your visual.

 

Then fiddle with the "sort by" settings at the visual level until you get it how you want it.

 

sortby.PNG

 

 

///Mediocre Power BI Advice, but it's free///

View solution in original post

1 REPLY 1
kpost
Super User
Super User

This solution is generalizable to many different situations where you want to force visuals to sort a certain way that cannot be done by Power BI because it is not alphabetical or increasing numerically etc.  I do it all the time.

 

Create a new table with two columns.

 

Column1:  City Name (contains all the cities, spelled exactly the same as they are spelled in your fact table)

Column 2:  Sort Order (Numerical values corresponding to the order you want them in the visual)

 

Then, open up this new table in Table View, click City Name, and sort by column "Sort Order"

sort.PNG

 

Open "Model View", and create an active many to one relationship between the City Name column in this new table and the City Name column in your fact table.

 

Use the City Name column from your newly created Dimension table in your visual.

 

Then fiddle with the "sort by" settings at the visual level until you get it how you want it.

 

sortby.PNG

 

 

///Mediocre Power BI Advice, but it's free///

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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