cancel
Showing results for
Did you mean:
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
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 )
4 REPLIES 4
Highlighted
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.
Frequent Visitor

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

Here is a data table :

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

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.

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 )
Frequent Visitor

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

Thanks !!

Announcements

#### 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

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

#### Power Platform World Tour

Find out where you can attend!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)