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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. 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
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.