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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
AmberJane
Helper III
Helper III

mins, hrs, days measure column not sorting correctly

This is a custom measure that is converting a whole number that represents minutes into mins, hrs and days but is not sorting how I would expect. Mins > Hrs > Days or vice versa. 

 

Any suggestios? 

AmberJane_0-1654800770161.png

 

1 ACCEPTED SOLUTION
Hariharan_R
Solution Sage
Solution Sage

Hi,

You can get the expected order using the reference table.

 

1. Create one table like below. You can use "Enter Data" option to create this static table.

Hariharan_R_0-1654839466720.png

2. Create one column in your main table in Power query layer. change it for your table column

 

= Table.AddColumn(#"Changed Type", "Type", each if Text.Contains([TTF], "mins") then "mins" else if Text.Contains([TTF], "days") then "days" else if Text.Contains([TTF], "hrs") then "hrs" else 0)

 

Hariharan_R_1-1654839535640.png

 

3. Connect table in step 1 and step 2 using the Type column

Hariharan_R_2-1654839620559.png

 

4. Create one calculated column in you main table using - 

Order = RELATED('Sort Table'[Order])

 

Hariharan_R_3-1654839707551.png

5. Select your main column and choose sort by column and select order.

Hariharan_R_4-1654839774388.png

 

Thanks

Hari

 

 

 

 

 

View solution in original post

1 REPLY 1
Hariharan_R
Solution Sage
Solution Sage

Hi,

You can get the expected order using the reference table.

 

1. Create one table like below. You can use "Enter Data" option to create this static table.

Hariharan_R_0-1654839466720.png

2. Create one column in your main table in Power query layer. change it for your table column

 

= Table.AddColumn(#"Changed Type", "Type", each if Text.Contains([TTF], "mins") then "mins" else if Text.Contains([TTF], "days") then "days" else if Text.Contains([TTF], "hrs") then "hrs" else 0)

 

Hariharan_R_1-1654839535640.png

 

3. Connect table in step 1 and step 2 using the Type column

Hariharan_R_2-1654839620559.png

 

4. Create one calculated column in you main table using - 

Order = RELATED('Sort Table'[Order])

 

Hariharan_R_3-1654839707551.png

5. Select your main column and choose sort by column and select order.

Hariharan_R_4-1654839774388.png

 

Thanks

Hari

 

 

 

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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