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

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

Thanks !!

Announcements

#### Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

#### Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

#### Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors (Last 30 Days)