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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
JoeCrozier
Helper II
Helper II

"Cannot convert null to logical" --when I know there are nulls and I want to keep them

Hello, I'm having a problem converting nulls to logical, and I know there are already a lot of questions like this online:

JoeCrozier_0-1682965068004.png

 

But I believe most of those come from the user not knowing where the nulls are.  I know where mine are, and I want to do something with them.  

Here's my code:

JoeCrozier_3-1682965236302.png

 

And as you can see, what I WANT my code to do is create a column that says a visit is late if the 'planned_late_days' is negative, say its on time if the number is positive, or say its not documented if that column was null (which would have happened if one of the columns needed for that calculation was blank).

Its mostly working, except when 'planned_late_days' is null, instead of saying its not documented, it throws an error.   Is there a workaround?  I dont want to filter out the nulls.

 

Thank you

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Try changing it from

else if [Column] = null then 

 

to

 

else if is null [column] then

 

Also note that you could eliminate the third leg altogether, since you have all the possibilities covered already, so

 

if negative then this, if positive then that, else null

 

--Nate

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Try changing it from

else if [Column] = null then 

 

to

 

else if is null [column] then

 

Also note that you could eliminate the third leg altogether, since you have all the possibilities covered already, so

 

if negative then this, if positive then that, else null

 

--Nate

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors