Hi clever people.
I'm creating a calendar table in Power Query and I'm trying to create a financial year column from the date. So if the date is <= 4/4/YYYY then it should show this year, if it's > 4/4/YYYY, it should return next year.
Here's my code.
This is wrong somewhere as in the example above, the first 4 days of EVERY month are output as 2021 and the 5th to the "31st" are output as 2022. Seems fairly simple, but I'm having a stupid moment I think.
Anyone able to tell me what I've done wrong?
Thanks
I'm creating a calendar table in Power Query and I'm trying to create a financial year column from the date. So if the date is <= 4/4/YYYY then it should show this year, if it's > 4/4/YYYY, it should return next year.
3/4/2021 | 2021 |
4/4/2021 | 2021 |
5/4/2021 | 2022 |
6/4/2021 | 2022 |
etc. |
Here's my code.
M:
= Table.AddColumn(#"Inserted Year", "FY", each
if
Date.Month([Date]) <= 4 and Date.Day([Date]) <= 4
then
Date.Year([Date])
else
Date.Year([Date]) + 1
)
This is wrong somewhere as in the example above, the first 4 days of EVERY month are output as 2021 and the 5th to the "31st" are output as 2022. Seems fairly simple, but I'm having a stupid moment I think.
Anyone able to tell me what I've done wrong?
Thanks