Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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?
@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
Hope this helps.
Regards,
@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:
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.
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.
Step 7 : Click on the three dots on the top right corner of your visual and select Sort axis > Sort ascending.
Expected Visual:
Regards,
Shalini
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
72 | |
38 | |
31 | |
27 |
User | Count |
---|---|
92 | |
50 | |
44 | |
40 | |
35 |