Hi, I have a dataset like this:
I want to calculate the cumulative sum of completion column by month and compare the value with the same month last year in a line chart, like the graph below:
Blue line is the cumulative completion for the current year and the pink line is the cumulative completion for the previous year.
Pink line is calculated as periodOverPeriodLastValue({Cumulative Completions}, {event_date}, MONTH, 12). {Cumulative Completions} is calculated as runningSum(sum({completion}),[{event_date} ASC]) I only want to show the current year date, in the example above - Jan 2023-Dec 2023. If I only select Jan 2023-Dec 2023, then periodOverPeriodLastValue doesn’t show any value in the graph.
I tried below methods too:
- ifelse(dateDiff({event_date},today(),“YYYY”) = 1, {Cumulative Completions}, 0). However, this shows error of mismatched aggregation.
- I also tried the windowsum windowSum(sum({completion}), [{event_date} ASC], 0, 12) but the result doesn’t seem correct.
Is there any other way to calculate the cumulative completion for the previous year and to show in the same graph? Thanks in advance!