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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Dax version of excel Match function

Good morning

I have 4 columns where I make decisions based on which column has the lowest value. I currently use the Match() function within Excel to do this, however, I am moving into a SQL environment and connecting my new database to PowerBi. How can I replicate the same functionality within Powerbi, in that I can identify which column has the lowest value? The returned value can be the column name or a numerical value.

 

Any assistance is greatly appreciated.

 

Allan

1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @Anonymous ,

 

I'd suggest to unpivot the columns first as they suggested here:

Solved: Minimum Value across multiple columns - Microsoft Power BI Community

 

Here a quick example:

tomfox_3-1656840966289.png

 

 

Then you unvpivot all columns that you wish to compare with each other to find the minimum value:

tomfox_1-1656840903437.png

 

You would end up with something like this:

tomfox_4-1656841009819.png

 

Lastly, create a measure in DAX like below:

ResultMeasure = 
VAR _minValue =
    CALCULATE ( MIN ( Table[Value] ), Table[Value] <> 0 )
RETURN
CONCATENATEX (
    FILTER ( Table, Table[Value] = _minValue ),
    Table45[Attribute.1],
    ", "
)

And you get the following result:

tomfox_6-1656841678188.png

 

 

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

2 REPLIES 2
tackytechtom
Super User
Super User

Hi @Anonymous ,

 

I'd suggest to unpivot the columns first as they suggested here:

Solved: Minimum Value across multiple columns - Microsoft Power BI Community

 

Here a quick example:

tomfox_3-1656840966289.png

 

 

Then you unvpivot all columns that you wish to compare with each other to find the minimum value:

tomfox_1-1656840903437.png

 

You would end up with something like this:

tomfox_4-1656841009819.png

 

Lastly, create a measure in DAX like below:

ResultMeasure = 
VAR _minValue =
    CALCULATE ( MIN ( Table[Value] ), Table[Value] <> 0 )
RETURN
CONCATENATEX (
    FILTER ( Table, Table[Value] = _minValue ),
    Table45[Attribute.1],
    ", "
)

And you get the following result:

tomfox_6-1656841678188.png

 

 

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Anonymous
Not applicable

@tackytechtom 

Thank you so much for the concise answer and it is greatly appreciated. I will build this in and get to work.

Weirdly excited to try this out lol

Cheers 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors