0

Good morning,

I am trying to create a new column in Power Query that looks at the dates of two columns. Please see the below image,

enter image description here

I am trying to create a custom column giving a 1 or 0 based on the EffDate and DeliveryDate columns. I want to give a 1 if the DeliveryDate column is the first day of the forward month of the EffDate, then a 0 if not. So for example, in line 1, for 12/31/2019, I want 1/1/2020. Using the function,

= Table.AddColumn(#"Renamed Columns", "Prompt Month", each if [DeliveryDate] = #date(Date.Year([EffDate]), Date.Month([EffDate])+1, 1) then 1 else 0)

does not work.

1 Answer 1

3

Date.Month([EffDate])+1 when [EffDate] is December is an error. There is no month after december

Try

if Date.AddMonths(Date.StartOfMonth([EffDate]),1) = [DeliveryDate] then 1 else 0
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.