I’ve got several queries that interrogate predefined dates, and the day number is added in a column to create an XY graph.

With Flux, I try to create an average value for each day, but I don’t have enough time for each value.
So I can’t insert it into the XY to see more easily which curve is above or below the average.

In addition to this, I’d like to create an indicator that establishes the difference between the current month’s cumulative total and the average cumulative total (comparable to today).

@Yohan You’re query is so close. When you group by dayOfMonth and calculate the daily mean, each day is represented by a single table. You need to “ungroup” into a single table and then sort by dayOfMonth:

How do I subtract the cumulative value by the average reference value to create an index.

For example, it’s the 25th of the month and the average reference (the one we’ve just made) is 48 and the value for the current period on the 25th is 40, so the index is +8. It would be negative if we were higher.

Create a custom function that returns the average per day of the month. Once the daily value and the daily average are in each row, you can just use map to subtract the average from the daily value.

Use a join to join on the day of the month and then subtract the mean from the daily value.