How to show cumulative current year and previous year running sum and include in the same line graph

Hello @kiko, this is definitely a fun challenge. I have spent some time trying to figure out the best way to do this as well and I will try to explain the solution that I have utilized in the past.

First thing I want to note though, on this method that you tried ifelse(dateDiff({event_date},today(),“YYYY”) = 1, {Cumulative Completions}, 0), if you switched today() for now(), you might resolve the error, but I am assuming that is likely related to other fields in the calculation, but it is worth a try.

Now, the way I have gone about displaying 2 years side by side, is creating an ifelse statement that will create category values that you will use in the color field well. Basically check your date field to see if it equals this year or last year, and return something like Current Year and Previous Year as strings. Then, to handle your x-axis, you will basically want to extract your dates to pull only the month value. This will allow you to show them month over month together with the x-axis displaying 1-12 instead of Jan, Feb, Mar, etc. Although, you may be able to extract the month name if you play around with it rather than just the number.

Then for your values, you will want to use an ifelse to figure out if your date field is within this year or last year, and return your values that exist within the this year/last year time constraints.

I will link the documentation below for the extract function, because that will be your best friend when building out the date portion of the visual.

I will mark this as the solution, but if you have any follow-up questions on this topic, please let me know. Implementing this can definitely be a bit tricky and I will do my best to help!