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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register 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.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors