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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Mk60
Resolver I
Resolver I

Is it possible to manually sort/order columns in this visual?

I wonder if I can manually change the order of the columns in this visual, (can't use default options high to low, or alphabetically order them). I would need to order columns explicitely based on the X axis descriptions, so column 1 should be first from the left, next would be column 2, next 3 and so forth? I would much apprecite any suggestion. Please advise! Thank you!

Mk60_0-1742938301412.png

 

2 ACCEPTED SOLUTIONS
hnguy71
Super User
Super User

Hi @Mk60 

Yes that's possible. You could create a sorting table for this sort of purpose. Here's an example:

hnguy71_0-1742938781377.png

 

Then select the category column and click 'Sort by Column' and then select the sort id:

hnguy71_1-1742938824618.png

 

And all that's left is to use the field from your sorting table. Make sure you have a relationship between the two tables based on your category. 

 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

Deku
Community Champion
Community Champion

Please see @hnguy71 post, he has the image for where you apply the sort by


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

10 REPLIES 10
hnguy71
Super User
Super User

Hi @Mk60 

Yes that's possible. You could create a sorting table for this sort of purpose. Here's an example:

hnguy71_0-1742938781377.png

 

Then select the category column and click 'Sort by Column' and then select the sort id:

hnguy71_1-1742938824618.png

 

And all that's left is to use the field from your sorting table. Make sure you have a relationship between the two tables based on your category. 

 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Deku
Community Champion
Community Champion

Yes. If you add a extra column to the same table as the axis label and give each item a interger value 1,2,3... Based on the order you want. You can then set the order by for your label column, based off that new column

 

https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-sort-by-column


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

My axis label is actually anoter calculated column. Would you mind to include example of the dax I would use to get those integer values you're suggesting here. Thanks much, Deku!

Deku
Community Champion
Community Champion

create a calculated column

 

sortBy =
SWITCH(
   table[axis label],
   "below 1:1", 1,
   "1.25-1.00", 2,
  ...
)

   


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Any suggestion on this error?

Mk60_0-1742942542172.png

 

Deku
Community Champion
Community Champion

can't mix integer (1,2,3) with text ("unknown"). Replace unknown with 9999


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

So using 9999 in Dax worked, thank you for that tip. Now, I am not sure how to add this new sorting column to the existing visual? If I add it to the existing X-axis metric it does add a second row of values on my X-axis, which I do not want? If I remove my existing metric it does not work? What am I not doing right here. 

Mk60_0-1742944029064.png

 

Hi @Mk60 

 

You don't need to add the sorting column to the visual. You need to custom sort DSC Bucket by SortBy column you created.

danextian_0-1742958446682.png

Note: you may not be able to custom sort successfully due to a circular dependency error - SortBy referencing DSC Bucket and DSC Bucket being sorted by SortBy. Either create SortBy column in the query editor using the add Conditional Column feature or duplicate the DSC Bucket column and sort the duplicate instead and use in in the visual.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi danextian

I did get the same circular dependency error as you mentioned when I tried your first suggestion. So I tried creating new table as suggested abowe, and was finally able to make it work for me here, but I am very interested in your option without new table, which I would prefer. I never used Conditional column option, (nor creating duplicate column), so I would love to explore those as well since I have few more metrics with the same sorting issue. Would you mind to provide some tips on using conditional column to solve this issue? So much apprecite your expertise, and time to help. That a lot!

Deku
Community Champion
Community Champion

Please see @hnguy71 post, he has the image for where you apply the sort by


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors