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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
hayleypnch
New Member

Custom Column with isblank and isnotblank

Hi All, 

 

I'm looking at creating a custom column based on the contents of 2 other columns. I want to say:

 

If column 1 and column 2 are both blank, display "outcome 1" in the column

 

If column 1 is not blank and column 2 is blank, display "Outcome 2" in the column

 

If Column 2 is not blank, display "Outcome 3" in the column.

 

I have written this:

 

if(ISBLANK [Column1] and ISBLANK[Colmun2], "Outcome1",
if(ISNOTBLANK [Column1] and ISBLANK [Column2],"Outcome2",
if(ISNOTBLANK[Column2], "Outcome3" ))))

 

But I'm getting an error under the "Outcome1" section. Any ideas?

 

2 REPLIES 2
Anonymous
Not applicable

Hi @hayleypnch ,

 

  •  Add a Custom column In Power Query
=if Text.Length([Column1])=0 and Text.Length([Column2])=0 then "Outcome1" else if Text.Length([Column1])>0 and Text.Length([Column2])=0 then "Outcome2" else "Outcome3"

Eyelyn9_1-1632896041912.png

 

  • Use DAX to add a column:
New Column = 
SWITCH (
    TRUE (),
    [Column1] = BLANK ()
        && [Column2] = BLANK (), "Outcome1",
    [Column1] <> BLANK ()
        && [Column2] = BLANK (), "Outcome2",
    [Column2] <> BLANK (), "Outcome3"
)

Eyelyn9_0-1632895399394.png

 

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

mahoneypat
Microsoft Employee
Microsoft Employee

Here is a column expression that should work.

 
Outcome = SWITCH(TRUE(),
Blanks[Column1] = "" && Blanks[Column2]="", "Outcome 1",
Blanks[Column2]="", "Outcome 2",
NOT(Blanks[Column2]=""), "Outcome 3")
 
Pat
 




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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