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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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