How can I do reset in window function?

Is it possible do a reset on window function into a compound metric ?
Thanks

What do you mean reset? window function are used for evaluation on shifted timeseries, may be you need something else like max / min or rolling.

The use case is this :
do moving average of customer’s consumptions
so i need reset average when customers change, without use previous consumption.
In this case reset means that the moving average will compute with only each customer’s consumption.
I solved with a custom function in JS but i don’t know if it’s the best solution.
thanks

Can you share your custom code for review and better understanding the problem as it’s not clear?

Usually when you evaluate your metric you will pass some ids and they should be enough to separate consumption (or other data) per id/user.

In this picture you can see what I mean.


As you can see there are 2 customers changes that cause 3 consumptions periods, the yellow line is a AVG window function, the red line is my custom function.
Here the detail
image

You may try defining a metric lastCC whose value is the timestamp of the last customer change (using tsDecl, value: start and treatment: PREVIOUS, etc.) Then you can multiply your AVG argument by the boolean (start() >= lastCC) to use 0 before the last customer change. You can then try improving your window, too (I am not sure about this part, though).