cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

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 a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

7 REPLIES 7
Microsoft
Microsoft

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 a 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 a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

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 a 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
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors