cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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 Ranks and Rank Icons in 2020

New Ranks and Rank Icons in 2020

Read the announcement for more information!

New Kudos Given Badges Coming

New Kudos Given Badges Coming

We're rolling out new Kudos Given badges. Find out how many Kudos you've given.

November 2019 Community Highlights

November 2019 Community Highlights

Get an overview of the events and great community content from November.

Power Platform World Tour

Power Platform World Tour

Find out where you can attend!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)