Continuous query on custom monthly range in Flux / InfluxQL

Hi
I have a bandwidth time-series database. Each customer has their own monthly billing period start date e.g. 15th to 15th or 1st to 1st and so on.

I would like to create a continuous query or task to downsample the data to calculate mean, max, sum and 95th percentile starting from the first day of the billing period until now.

Can this be accomplished somehow? I thought of storing the billing period start day somewhere in my bandwidth measurement e.g “billing_start” = 15, but don’t know how to specify it in the range clause for Flux, or time for InfluxQL

Thanks!

If I was faced with something like this I would probably do something like that too.

But if that’s not looking promising either, perhaps you could make a generic task that calculates those stats by calendar day. And then figure out a grouping mechanism with the customer specific start date as another task (ie separating them into two tasks might be the way to go)

1 Like