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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Nested ifs

I'm flummuxed as to why this if statement only returns the first element and errors on the others. any assistance is gratefully recieved. T

 

if [Column1]>0 then "Other" else

if [Column2]>0 and [Column3] is null then "Closed" else

if [Column2]is null and [Column3]>0 then "Open" else ""

 

There are no syntax errors but I do get this as an explanation:

 


Expression.Error: We cannot convert the value null to type Logical.
Details:
Value=
Type=[Type]

 

My columns have either a number or null value

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Anonymous 

First thing, make sure you have numbers in Column 1 ,2 and 3 then apply the new column as follows:

if [Column1] > 0 then "Other" else if ([Column2]> 0 and [Column3] is null) then "Closed" else if ([Column2] is null and [Column3] > 0) then "Open" else null
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
Fowmy
Super User
Super User

@Anonymous 

First thing, make sure you have numbers in Column 1 ,2 and 3 then apply the new column as follows:

if [Column1] > 0 then "Other" else if ([Column2]> 0 and [Column3] is null) then "Closed" else if ([Column2] is null and [Column3] > 0) then "Open" else null
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Thanks Fowmy. The solution was indeed to ensure that all Columns were returning a number. I then changed the formula accordingly. Guess it doesn't like mixing data types.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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