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
blazko
Helper III
Helper III

MIN, exlude blanks

Hi, I need to exlude BLANK's from a calculation, but cant't find the righ way. I want to create a calculated column to be exact, MIN from two other column, but when one of them is blank, the whole calculation returns blank. How do I avoid that? Thx in advance!

1 ACCEPTED SOLUTION
Yggdrasill
Responsive Resident
Responsive Resident

Well this is kinda silly but here goes

 

Column =
IF (
    ISBLANK ( Table1[Column1] + Table1[Column2] );
    BLANK ();
    IF (
        ISBLANK ( Table1[Column1] );
        Table1[Column2];
        IF (
            ISBLANK ( Table1[Column2] );
            Table1[Column1];
            IF ( Table1[Column1] <= Table1[Column2]; Table1[Column1]; Table1[Column2] )
        )
    )
)

min.PNG

View solution in original post

4 REPLIES 4
bobmclaren
Regular Visitor

I realize this request is a couple years old, but I came here yesterday looking for the same answer and managed to come up with a solution that I was rather proud of so I thought I would share in case it helps somebody else in our situation.  Many thanks to sqlbi.com for the guidance!

 

The idea is, you put your values into a column, and then grab the first (minimum) non-blank value using the FIRSTNONBLANK function.  Simple!

 

Example:

FIRSTNONBLANK({[Value1],[Value2],[Value3]},1)

 

bobmclaren_0-1662124431784.png

 

I needed to find the minimum value across 5 columns where a blank was possible but I needed blanks to be ignored. This solution and the FIRSTNONBLANK formula is exactly what I needed. Thanks for the example including the curly { } brakets.

Yggdrasill
Responsive Resident
Responsive Resident

Well this is kinda silly but here goes

 

Column =
IF (
    ISBLANK ( Table1[Column1] + Table1[Column2] );
    BLANK ();
    IF (
        ISBLANK ( Table1[Column1] );
        Table1[Column2];
        IF (
            ISBLANK ( Table1[Column2] );
            Table1[Column1];
            IF ( Table1[Column1] <= Table1[Column2]; Table1[Column1]; Table1[Column2] )
        )
    )
)

min.PNG

Could you put an example with more than 2 columns?

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.