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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
SevsBo
Helper V
Helper V

Sorting X axis of Chart by Data Categories

I have a data set that includes the amount of time someone spent on a page. For analysis, I have created bins in Power Query to split out those times as follows:

 

- No Time

- 1 - 15 seconds

- 16 to 30 seconds

- etc...

- 1h plus

 

Now when I first created a chart that looks at the sum within those bins to show which bin is most common for the site visitors, I got a chart that sorted by default based on the largest total bin and went down from there. But I also wanted to see how those bins compare to each other if sorted in a logical order, so starting with the bin for the smallest values, and moving onward.

 

I thought I could do that by prefixing the bin names with numbers, so now it's:

 

- 1: No Time

- 2: 1 - 15 seconds

- 3: 16 - 30 seconds

- etc

 

But when I create a chart it still only sorts by the value of the total bins, so the bins are out of order, if that makes sense.

 

Is there a way to create a sorting of the X axis based on the names of the bins?

2 REPLIES 2
rsbin
Super User
Super User

@SevsBo ,

The way you are doing it will work.  Simply click on the ellipsis (3 dots) in the top right corner or your visual.

You will see a sort axis option.  Then you can sort by Bin in Ascending order.

A cleaner way to do this is create another column called something line BinSortOrder.  Once you have the values populated in here you can use ColumnTools to sort your Bin Column by your BinSortOrder column

rsbin_1-1698863796105.png

Hope this helps.

Regards,

 

Shalini_T
Frequent Visitor

@SevsBo
Step 1 : First you have to duplicate your original table and remove all the columns expect the time bin column.
Step 2 : Create a index column from 'Add Column' Tab.

Duplicated Table:

Shalini_T_3-1698863362800.png


Step 3 : Load the Newly created table along with your original table to your Power BI Desktop.
Step 4 : Create a relationship between the original table and newly created table in model view. The relationship column is 'Bin Column' from the original table and 'Bin Column' from the duplicated new table.

Shalini_T_1-1698863254767.png


Step 5 :
Now use the Bin Column from the duplicated new table in x-axis of the visual.
Step 6 : Now go to the Data view and sort the 'Bin Column' of the duplicated table based on index column by using Sort By Column Option.

Shalini_T_4-1698863459541.png

Step 7 : Click on the three dots on the top right corner of your visual and select Sort axis > Sort ascending.

Shalini_T_0-1698863993438.png

 

Expected Visual:

Shalini_T_5-1698863594853.png

 


Regards,
Shalini

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.