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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
camelCase
New Member

Custom Sort Order - First/Last not working as expected (erroneously ignores custom sort order)

I have a formatted date column (Date_ddd_dd_hh = FORMAT('mydata'[DateStarted], "dd/mm, ddd HH:00 yyyy"))

custom sorted on (Date_ddd_dd_hh_sort = FORMAT('mydata'[DateStarted], "yyyy-mm-dd HH"))

 

When using First or Last the custom sort is erroneously ignored - is there a way to display the correct first/last date in the custom formatting (ie. showing first/last dates in a format not specified in the default date format list)

 

Correct custom sort in table.INCORRECT when specifying FIRSTINCORRECT when specifying LAST
camelCase_3-1672741797905.pngcamelCase_4-1672741837543.png

 

 

camelCase_5-1672741865859.png

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@camelCase , You might have to create a measure like

 


measure =
Var _min = minx(allselected(Table), Table[custom sorted])
return
maxx(filter( Table, Table[custom sorted] =_min),Table[formatted date])

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

1 REPLY 1
amitchandak
Super User
Super User

@camelCase , You might have to create a measure like

 


measure =
Var _min = minx(allselected(Table), Table[custom sorted])
return
maxx(filter( Table, Table[custom sorted] =_min),Table[formatted date])

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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
Top Kudoed Authors