Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

DAX way to find a value in a column adjacent to another value

Hi guys, newbie here!

 

I have a data structured like the follow

 

CustomerTypeValueFlag
A33.50
A32.21
A27.31
A24.90

 

I need to create a Matrix that shows, for every Type, the MIN(Value) and the corresponding Flag.

 

In this case I want this result:

CustomerTypeMIN(val)Flag
A32.20
 24.90

 

I tried woth the default setting (min of Flag) in the Visualizations pane, but I've noticed this new case in which tha flag 0 doesn't correspond with the minimum value for this Type. 

So basically I need something like a LOOKUP to retrieve the value (for the flag column) of the cell in the same row but for the value column.

 

 

thank you a lot!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous , 

Please refer to my pbix file to see if it helps you.

Create a measure.

_minvalue =
VAR _minvalue =
    CALCULATE (
        MIN ( 'Table'[Value] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Customer] = SELECTEDVALUE ( 'Table'[Customer] )
                && 'Table'[Type] = SELECTEDVALUE ( 'Table'[Type] )
        )
    )
RETURN
    IF (
        MAX ( 'Table'[Value] ) = _minvalue,
        MINX ( ALL ( 'Table' ), 'Table'[Flag] ),
        BLANK ()
    )

vpollymsft_0-1647936723539.png

f I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous , 

Please refer to my pbix file to see if it helps you.

Create a measure.

_minvalue =
VAR _minvalue =
    CALCULATE (
        MIN ( 'Table'[Value] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Customer] = SELECTEDVALUE ( 'Table'[Customer] )
                && 'Table'[Type] = SELECTEDVALUE ( 'Table'[Type] )
        )
    )
RETURN
    IF (
        MAX ( 'Table'[Value] ) = _minvalue,
        MINX ( ALL ( 'Table' ), 'Table'[Flag] ),
        BLANK ()
    )

vpollymsft_0-1647936723539.png

f I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

amitchandak
Super User
Super User

@Anonymous , Try measure like this for

 

flag and take min for value

 

Measure =
VAR __id = MAX ('Table'[Customer] )
VAR __date = CALCULATE ( Min('Table'[Value] ), ALLSELECTED ('Table' ), 'Table'[Customer] = __id )
return
CALCULATE ( Max ('Table'[Flag] ), VALUES ('Table'[Customer] ),'Table'[Customer] = __id,'Table'[Value] = __date )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors