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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.