Forum Discussion
Anonymous
4 years agoNot applicable
Power Query formula
Hello - We have business logic that says: Based on the forecsat lockdown month (we "lock" our CRM forecast down at the 1st of each month and give it a file name like October 2021), then add 2 mon...
- 4 years ago
Ah, ok.
Try something like this:
if [reqShipDate] >= Date.StartOfMonth(Date.AddMonths([lockDownMonth], 2)) and [reqShipDate] <= Date.EndOfMonth(Date.AddMonths([lockDownMonth], 2)) then "True" else "False"Pete
- Anonymous4 years ago
BA_Pete Thanks for your help. With some additonal help in the forums I eventually figured out the correct formula...but you got me a starting point!
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"
BA_Pete
4 years agoSuper User
Ah, ok.
Try something like this:
if
[reqShipDate] >= Date.StartOfMonth(Date.AddMonths([lockDownMonth], 2))
and
[reqShipDate] <= Date.EndOfMonth(Date.AddMonths([lockDownMonth], 2))
then "True"
else "False"
Pete
Anonymous
4 years agoNot applicable
BA_Pete I was able to get rid of the error in the code, by adding partenthesis. However, now the column itself (the output of the formula) shows error. So, perhaps the formula needs to be adjusted?
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"