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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Anonymous
Not applicable

Expression.Error We cannot convert the value null to type logical

I am getting an issue when I try to filter a certain column. This column is added and the code is as follow 

if Date.Month([date]) < Date.Month(Date.From(DateTime.LocalNow())) then 1 else Date.Day([date]) 

In the first image is before I tried to filter. I would like to point out that when I load all values it goes empy (see second image). The error message I get is 

 

Expression.Error: We cannot convert null to type logical.
Detail:
Value=
Type=[Type]

 

 

AlekseiNexa_0-1602730789089.png   

AlekseiNexa_1-1602731014022.png   

 
 
 
 
 
 

 

 

 

 

1 ACCEPTED SOLUTION
MattAllington
Community Champion
Community Champion

It's hard to say. Most likely there is a step earlier in the query that triggers an error in a row that is not loaded in the preview. PQ loads 1,000 rows and uses those to help you write the query. But if something strange happens after row 1,000  can happen. Look for "changed Type" steps on your date column. Go to the step prior and then click the drop down list like you showed. This should load the full list so you can identify the issue. Also you could force column profiling to load the entire data set. This option is on the bottom left. Change if from 1,000 to all data. This my also help. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

1 REPLY 1
MattAllington
Community Champion
Community Champion

It's hard to say. Most likely there is a step earlier in the query that triggers an error in a row that is not loaded in the preview. PQ loads 1,000 rows and uses those to help you write the query. But if something strange happens after row 1,000  can happen. Look for "changed Type" steps on your date column. Go to the step prior and then click the drop down list like you showed. This should load the full list so you can identify the issue. Also you could force column profiling to load the entire data set. This option is on the bottom left. Change if from 1,000 to all data. This my also help. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.