Fixed Date comparison

Jones01 Contributor
edited October 2022 in Magic ETL


I have monthly data and have the data stacked with different period types i. Last year, 2021, 2020 and 2019.

I can access these values by checking the period type in my beast modes. All good.

For this use case I need to add a fixed 2019.

So when I graph say 2021 through to 2023 each month looks back at 2019. e.g. I can graph the variance between the month Jan 2022 against Jan 2019 and Jan 2021 can also be shown against 2019.

I want to add a 2019 period type but it isn't just a case of subtracting months from the date as it is relative to the same month n 2019.

The below looks back 2 years, I'm not sure how to modify this using the functions available.

Any help would be appreciated.


  • Jones01
    Jones01 Contributor

    for anyone that has a similar problem I resolved this by still using the concept outlined by @GrantSmith but also added a Comparison date with the formula DATE(STR_TO_DATE(CONCAT('01-',MONTHNAME(`dt`),'-2019'), '%d-%M-%Y')) so I could compare any month to 2019.