Varying size window


I would like to create a metric where the size of the window is the minimum between a fixed size and the number of days since some event:

window('AVG', NumMaintenanceOrdersPRV, - min(90, DaysSinceLastChainFailure) + 1, min(90, DaysSinceLastChainFailure))

Is that possible? If yes how?


Write a compoundMetric with exactly the expression you put above. If you have issues post them here.


That is the error I have:

Error: Internal error: can't infer value type for expression : ChainFailure↵    at new C3.client.ActionError (↵    at Object.request (↵    at (↵    at c3Call (↵    at Object._call (↵    at Object.eval (eval at get (, <anonymous>:5:15)↵    at <anonymous>:1:20

Where ChainFailure is a metric defined as:

  "id": "ChainFailure_FormingChain",
  "name": "ChainFailure",
  "srcType": "FormingChain",
  "tsDecl": {
    "data": "failures",
    "start": "changeDate",
    "treatment": "COUNT",
    "transform": "fillMissing(this, 0)"

And DaysSinceLastChainFailure is:

eval('AVG', 'DAY', rolling('SUM', identity(1), ChainFailure), dateTime('2011-01-01'))

For now this is not availble. Custom code can be created as in Creating Expression Engine Function and Add to Window