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 September 15. Request your voucher.

Reply
Anonymous
Not applicable

Column sorting issue in Power Bi

HI, 

 

Can somebody help me with this sorting issue?

I cannot do it with the regular sorting solution, as it sorts just the first digit, then the second and so on. I am trying to sort the Aging column. 

 

Thank you. 

 

Sorting issue.png

2 ACCEPTED SOLUTIONS
MartynRamsden
Solution Sage
Solution Sage

Hi @Anonymous 

 

Create a calcualted column in the same table as your 'Aging RW' column:

AgingRW Sort = 
SWITCH ( 
    Table1[Aging RW),
    "0-30", 1,
    "31-60", 2,
    "61-90", 3,
    "91-120", 4,
    "121-150", 5,
    "151-180", 6,
    "180+", 7,
    8
)

 

Then, in the 'Column tools' sub-menu, sort your Aging RW column by your new column.

For more info, see about half way down this page: docs.microsoft.com/en-us/power-bi/desktop-sort-by-column 

 

Best regards,

Martyn

 

If I answered your question, please help others by accepting it as a solution.

View solution in original post

amitchandak
Super User
Super User

Create a new sort column in the table and mark that as the sort column.

Sort_by_column.png

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Thank you Martyn. 

It would have worked in normal circumstances, but my column was already sorted and cannot do it. Tried combining all possibilities. See pic below. 

I have no idea what to do next. 

 

sorting issue 2.png

amitchandak
Super User
Super User

Create a new sort column in the table and mark that as the sort column.

Sort_by_column.png

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi Amitchandak, 

 

IT would have worked, if the column wasn't already sorted. Please see below the printscreen:

sorting issue 3.png

MartynRamsden
Solution Sage
Solution Sage

Hi @Anonymous 

 

Create a calcualted column in the same table as your 'Aging RW' column:

AgingRW Sort = 
SWITCH ( 
    Table1[Aging RW),
    "0-30", 1,
    "31-60", 2,
    "61-90", 3,
    "91-120", 4,
    "121-150", 5,
    "151-180", 6,
    "180+", 7,
    8
)

 

Then, in the 'Column tools' sub-menu, sort your Aging RW column by your new column.

For more info, see about half way down this page: docs.microsoft.com/en-us/power-bi/desktop-sort-by-column 

 

Best regards,

Martyn

 

If I answered your question, please help others by accepting it as a solution.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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