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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.