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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
JeroenN
Advocate I
Advocate I

Sorting date based axes

Power Bi sorts the X axes in a histogram automatically in alphabetic order. Is there a way to change this? I tried to add a numeric column to the axes, but this doesn't seem to work.

Anybody have a suggestion?

Thanks!

 

?Sort.png

1 ACCEPTED SOLUTION

Sorry, I am still not 100% up with the correct terminology in Power BI.

On the home ribbon/menu of Power Bi Desktop, on the left hand side, click on the middle icon (Data view - not table view- sorry).

Select your table

select the Name column you want to resort in a different order

Click on the modelling ribbon/menu

Click "sort by column", and then select the id column

Go back to your report (top icon, report view on the left hand side).



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

7 REPLIES 7
alexpancakes
Microsoft Employee
Microsoft Employee

Hi. 

(1) First you need to sort your "RegionID" (ascending).

sortCountries1.png

(2) Then you need to sort Counties by this ID. Arrow shows that the first step was succesfully done.

 sortCountries2.png

(3) Then you are ready to create your charts. I added name for "region" as a new column with simple IF() statement to visualize the sorting better.

 sortCountries3.png

MattAllington
Community Champion
Community Champion

If you have a sort order in mind, load that up with your dimension data. Then in the table view, select "sort by column" to sort the Alpha column by the numeric column 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Hello Matt

I can't get it to work in the right way.

I've got a very simple table with three columns: CountrId, CountryName and Score. The column CountryId is the column I want to sort the histogram by, but Power Bi sorts the axes in het alphabetic order. 

What do you mean by 'table view'? 

Sorry, I am still not 100% up with the correct terminology in Power BI.

On the home ribbon/menu of Power Bi Desktop, on the left hand side, click on the middle icon (Data view - not table view- sorry).

Select your table

select the Name column you want to resort in a different order

Click on the modelling ribbon/menu

Click "sort by column", and then select the id column

Go back to your report (top icon, report view on the left hand side).



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

The data in the tabel are already sorted the right way - that has no effect on the visual.

I also looked at: https://powerbi.microsoft.com/en-us/documentation/powerbi-desktop-sort-by-column/ . In my histogram the button 'Sort by Column' cannot be clicked. 

 


@JeroenN wrote:

The data in the tabel are already sorted the right way - that has no effect on the visual.

 


Are you saying you have followed my instructions and it didn't work?



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Now it works!

I missed one part, because of the fact that my menu's are in Dutch.

Thanks Matt.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors