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 - find lowest value of three variables over 0

Hi,

 

I have created three variables that do a calculation and return a single value. I now need to figure out which of these thress is the lowest but over 0.

 

Let's say I have:

 

var No1 = 2 

var No2 = 0

var No3 = 6

 

I want to declare a variable that returns No1 in the above case as it is the lowest value out of the three that is over 0.

I'll need this variable for a calculation later on in my code.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I found a (very ugly) solution:

 

VAR lowestoverzerso =
MIN (
MIN ( IF ( No1 < 1, No2, No1), IF ( No2< 1, No1, No2 ) ),
IF (
No3 < 1,
MIN ( IF ( No1 < 1, No2, No1), IF ( No2< 1, No1, No2 ) ),
No3
)
)

View solution in original post

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

Something like this ..May be

 

var No1 = 2 
var No2 = 0
var No3 = 6
VAR lowest=MINX(Filter({No1,No2,No3},[Value]>0),[Value])

Regards
Zubair

Please try my custom visuals
Anonymous
Not applicable

What is [Value] refering to in this formula?

@Anonymous 

 

When we create a table manually like { "a","b"}, the column name of the that table is "Value"

 

 


Regards
Zubair

Please try my custom visuals
Anonymous
Not applicable

I found a (very ugly) solution:

 

VAR lowestoverzerso =
MIN (
MIN ( IF ( No1 < 1, No2, No1), IF ( No2< 1, No1, No2 ) ),
IF (
No3 < 1,
MIN ( IF ( No1 < 1, No2, No1), IF ( No2< 1, No1, No2 ) ),
No3
)
)

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.