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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ChrisDg
Helper I
Helper I

Sorting by number ranges

Hi,

 

I'm new to Power BI and I'm having issues sorting my x-axis for my column chart. This is the formula I used to get my index: 

 

Index =
SWITCH (
    'Company size_Report'[Company size],
    "1", 1,
    "2-10", 2,
    "11-50", 3,
    "51-200", 4,
    "201-500", 5,
    "501-1000", 6,
    "1001-5000", 7,
    "5001-10000", 8,
    9)
 
I've gone to the sort by index section in the data field: 
 
ChrisDg_0-1660742548688.png

 

I've sorted the axis by company size and have not included the index in my visual. I was previously told to disable the sort completely (which I can't find out how to do that) and removing the company size field from the visual and adding it back. As an end result, I keep getting my graph looking like this: 

 

ChrisDg_1-1660742764718.png

 

 

How do I get my graph to sort the way that I have it set up in my index?

 

Thank you,

 

Chris 

 

1 ACCEPTED SOLUTION

Hi Winniz,

 

I figured this out on Friday. Thank you for your response! I did the same thing. However, I will add that this solution won't be resolved unless you also drag the Index column into the Tooltips bar: 

 

ChrisDg_0-1661174893513.png

 

 

Thank you,

 

Chris 

View solution in original post

4 REPLIES 4
KT_Bsmart2gethe
Impactful Individual
Impactful Individual

Hi @ChrisDg ,

 

Below link should give you the instruction you need:

https://radacad.com/sort-a-column-with-a-custom-order-in-power-bi

 

Regards

KT

v-kkf-msft
Community Support
Community Support

Hi @ChrisDg ,

 

First add the index column in the Power Query Editor, and then sort the [Company size] column by the Index column. Note that the index column needs to correspond to the value of [Company size] one by one.

 

Sort one column by another column in Power BI 

 

vkkfmsft_0-1661133710162.png

vkkfmsft_1-1661133785431.png

 

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi Winniz,

 

I figured this out on Friday. Thank you for your response! I did the same thing. However, I will add that this solution won't be resolved unless you also drag the Index column into the Tooltips bar: 

 

ChrisDg_0-1661174893513.png

 

 

Thank you,

 

Chris 

ChrisDg
Helper I
Helper I

Sorry, I forgot to check sort axis by company size. It looks like this: 

 

ChrisDg_0-1660742902335.png

 

 

Thank you,

 

Chris 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors