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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.