Varying size window

#1

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?

#2

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

#3

That is the error I have:

Error: Internal error: can't infer value type for expression : ChainFailure↵    at new C3.client.ActionError (https://knauf-pm.c3-e.com/typesys/1/all.js?env=browser&compat:1129:13)↵    at Object.request (https://knauf-pm.c3-e.com/typesys/1/all.js?env=browser&compat:881:15)↵    at Object.call (https://knauf-pm.c3-e.com/typesys/1/all.js?env=browser&compat:566:27)↵    at c3Call (https://knauf-pm.c3-e.com/typesys/1/all.js?env=browser&compat:99:20)↵    at Object._call (https://knauf-pm.c3-e.com/typesys/1/all.js?env=browser&compat:2704:20)↵    at Object.eval (eval at get (https://knauf-pm.c3-e.com/typesys/1/all.js?env=browser&compat:3114:20), <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'))
#4

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