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
rmcgrath
Advocate II
Advocate II

Rearrange a dimension table?

I have a dimension table for "Delinquency" in an Accounts Receivable Power BI report.  It looks like this:

rmcgrath_0-1728683236649.png

Is there a way to have "Current" be the first row and the rest follow as is?  I tried adding "00_" to Current ("00_Current") but it didn't work

1 ACCEPTED SOLUTION
AmiraBedh
Super User
Super User

If you want to use DAX, you need a CC :

 

SortOrder = 
SWITCH(
    TRUE(),
    'Delinquency'[Delinquency] = "Current", 1,
    'Delinquency'[Delinquency] = "01_to_15_Days", 2,
    'Delinquency'[Delinquency] = "16_to_30_Days", 3,
    'Delinquency'[Delinquency] = "31_to_60_Days", 4,
    'Delinquency'[Delinquency] = "61_to_90_Days", 5,
    'Delinquency'[Delinquency] = "91_and_Over", 6,
    7 -- Default if none match
)

 

Then you can sort your column based on SortOrder.

 

If you want to use PQ, you can add a custom column like below :

= if [Delinquency] = "Current" then 0
else if [Delinquency] = "01_to_15_Days" then 1
else if [Delinquency] = "16_to_30_Days" then 2
else if [Delinquency] = "31_to_60_Days" then 3
else if [Delinquency] = "61_to_90_Days" then 4
else if [Delinquency] = "91_and_Over" then 5
else 6

Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

View solution in original post

3 REPLIES 3
danextian
Super User
Super User

Basing on the screenshot, you can add another column in Power Query by extracting the first two characters which will be 01, 16, 31, 61, 91 and Cu. Then use that column sort the Delinquency column by.  They will be a text string but they will be in the correct order.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
sevenhills
Super User
Super User

Add a new column and use sort by feature and hide from report view

sevenhills_0-1728689705676.png

 


https://help.zebrabi.com/kb/power-bi/add-a-sorting-column/

 

AmiraBedh
Super User
Super User

If you want to use DAX, you need a CC :

 

SortOrder = 
SWITCH(
    TRUE(),
    'Delinquency'[Delinquency] = "Current", 1,
    'Delinquency'[Delinquency] = "01_to_15_Days", 2,
    'Delinquency'[Delinquency] = "16_to_30_Days", 3,
    'Delinquency'[Delinquency] = "31_to_60_Days", 4,
    'Delinquency'[Delinquency] = "61_to_90_Days", 5,
    'Delinquency'[Delinquency] = "91_and_Over", 6,
    7 -- Default if none match
)

 

Then you can sort your column based on SortOrder.

 

If you want to use PQ, you can add a custom column like below :

= if [Delinquency] = "Current" then 0
else if [Delinquency] = "01_to_15_Days" then 1
else if [Delinquency] = "16_to_30_Days" then 2
else if [Delinquency] = "31_to_60_Days" then 3
else if [Delinquency] = "61_to_90_Days" then 4
else if [Delinquency] = "91_and_Over" then 5
else 6

Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

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.