cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
fhendrick Frequent Visitor
Frequent Visitor

How to get DAX MIN (or MAX) value based on SORT BY COLUMN rule

Hi all,

 

Quite simple issue : I'm looking for a way to get MIN(columnA) knowing that column has been sorted by another columnB.

 

columnA data type = Text

 

Currently the MIN() function give me the minimum value with values beginning by "A"..

 

Thanks !

1 ACCEPTED SOLUTION

Accepted Solutions
AkhilAshok Established Member
Established Member

Re: How to get DAX MIN (or MAX) value based on SORT BY COLUMN rule

Multiple ways to do this. Easiest way is to find the min order and get the Word for the min order:

Min Word =
VAR MinOrder =
    MIN ( 'Table'[Order] )
RETURN
    CALCULATE ( MIN ( 'Table'[Words] ), 'Table'[Order] = MinOrder )

View solution in original post

4 REPLIES 4
Microsoft v-jiascu-msft
Microsoft

Re: How to get DAX MIN (or MAX) value based on SORT BY COLUMN rule

Hi @fhendrick,

 

What's the expected result? Maybe share a sample too.

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
fhendrick Frequent Visitor
Frequent Visitor

Re: How to get DAX MIN (or MAX) value based on SORT BY COLUMN rule

Here is a data table :

Table.PNG

 

I sorted the column "Words" by the column "Order" :

Sorted.PNG

I'd like to get in DAX : MIN(Words) = "What" instead of "A".

 

I wonder if the DAX logic could respect the sort order I set previously.

AkhilAshok Established Member
Established Member

Re: How to get DAX MIN (or MAX) value based on SORT BY COLUMN rule

Multiple ways to do this. Easiest way is to find the min order and get the Word for the min order:

Min Word =
VAR MinOrder =
    MIN ( 'Table'[Order] )
RETURN
    CALCULATE ( MIN ( 'Table'[Words] ), 'Table'[Order] = MinOrder )

View solution in original post

fhendrick Frequent Visitor
Frequent Visitor

Re: How to get DAX MIN (or MAX) value based on SORT BY COLUMN rule

Thanks !!

Helpful resources

Announcements
New Kudos Received Badges Coming

New Kudos Received Badges Coming

Kudos to you if you earned one of these! Check your inbox for a notification.

Microsoft Implementation for Communities Wins Award

Microsoft Implementation for Communities Wins Award

Learn about the award-winning innovation that was implemented across Microsoft’s Business Applications Communities.

Power Platform World Tour

Power Platform World Tour

Find out where you can attend!

Top Kudoed Authors (Last 30 Days)
Users online (1,545)