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
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.

View solution in original post

7 REPLIES 7
alexpancakes
Employee
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

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.

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.

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.

Now it works!

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

Thanks Matt.

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.

Top Solution Authors