Update Metric Path



I have changed the Path of a Metric but when I run the EvalMetric it seems like it used the previous path.
I tried with the tsEval and it works.

So should I run something to refresh this Metric ?

res = Facility.evalMetrics({
            expressions: ['ElectricityConsumptionInterval'],
            ids: ["711071916"],
            start: '2018-02-01',
            end: '2019-03-01',
            interval: 'MONTH',
            include: 'dates',
            explain: true,
            //cache: true,
            options: {evalPlanInclude: "rewritetenExp,evalInstrumentation,hierarchies"}

ts2 = Facility.tsEval({
projection:"sum(sum(servicePoints.measurements.(resource.id == 'electricity' && measurementCategory == 'MonthlyConsumption').normalized.data.quantity))",          
  start: '2018-01-01',
  end: '2019-02-01',
 grain: 'MONTH', filter:"id=='711071916'"


The Metrci :
The previous Path = “servicePoints.measurements”


 srcType: { ... }
 typeName: Facility
 path: servicePoints.measurements.(resource.id == 'electricity' && measurementCategory == 'MonthlyConsumption')
 id: ElectricityConsumptionInterval
 version: 1
 name: ElectricityConsumptionInterval
 expression: sum(sum(normalized.data.quantity))


This looks a correct metric definition assuming you have both measurementCategory and resource .id defined on your measuremnts.
May be the problem is with the underlying data, check if you have elec data with this category, e.g.

  filter: "resource.id == 'electricity' && measurementCategory == 'MonthlyConsumption'"


try this

var sm = SimpleMetric.make({
  srcType: 'Facility',
  path: "servicePoints.measurements.(resource.id == 'electricity' && measurementCategory == 'MonthlyConsumption')",
  expression: "sum(sum(normalized.data.quantity))",
  name: "ElectricityConsumptionInterval",
  id: "ElectricityConsumptionInterval_Facility"

var res = Facility.evalMetricsWithMetadata({expressions: ['ElectricityConsumptionInterval'],
            ids: ["711071916"],
            start: '2018-02-01',
            end: '2019-03-01',
            interval: 'MONTH'}, [sm])


it’s giving me