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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Anonymous
Not applicable

Power Query error (in column)

Any help on adjusting this code to get rid of this error would be appreciated.   If I click on  "error" in the custom column, the error message is below.   But not sure how to adjust the formula to get rid of this error.  

 

The formula itself does not show an error, but clearly it's not working:  

 

if
([Customer Requested Ship Date]) >= Date.StartOfMonth(Date.AddMonths([Locked File Month]), 2)
and
([Customer Requested Ship Date]) <= Date.EndOfMonth(Date.AddMonths([Locked File Month]), 2)
then "True"
else "False"

texmexdragon_0-1634061618358.png

 



1 ACCEPTED SOLUTION

Probably one of your date columns has a null. Try inserting this immediately after your if

[Customer Requested Ship Date] <> null and [Locked File Month] <> null and

 

View solution in original post

4 REPLIES 4
AlexisOlson
Super User
Super User

You closed your parentheses for Date.AddMonths before specifying how many months to add.

Try this:

 

if
[Customer Requested Ship Date] >= Date.StartOfMonth(Date.AddMonths([Locked File Month], 2))
and
[Customer Requested Ship Date] <= Date.EndOfMonth(Date.AddMonths([Locked File Month], 2))
then "True"
else "False"

 

Anonymous
Not applicable

Hi @AlexisOlson    That seems to have worked!  But getting one issue:    It does return True or False, but if I "load all" I see an error that says  "expression.error we cannot convert the value null to type logical"   Any idea what that is about?   

Probably one of your date columns has a null. Try inserting this immediately after your if

[Customer Requested Ship Date] <> null and [Locked File Month] <> null and

 

Anonymous
Not applicable

@AlexisOlson    Thank you!   Everything provided is working perfectly.  

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors
Users online (3,881)