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
Highlighted
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
v-jiascu-msft Super Contributor
Super Contributor

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.

Highlighted
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
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 398 members 3,412 guests
Please welcome our newest community members: