Metrics: filter by


#1

I’m working on a metric that takes total billed electricity spending and total gross area and returns spending per area(c3base/base/lci/seed/lci/CompoundMetric/billedElectricitySpend_perArea.json):

{
  "id" : "billedElectricitySpend_perArea",
  "name" : "Electricity Spending per Total Area",
  "expression" : "GrossFloorArea > 0 ? billedElectricitySpend / GrossFloorArea : null",
  "unit" : {
    "id" : "dollars-per-sqft"
  }
}

The metric should work for both facilities and organizations. The problem I want to avoid: if a facility does not have a GrossFloorArea, I do not want to include its associated spending in the total and instead capture that as missing %.

For example, if I have three facilities in an organization and they have the following spending and area: $300/150 sqft, $200/100 sqft, $100/ null. I want to end up with $500/250sqft + 33% missing instead of $600/250sqft. My understanding of the metrics is that I should get my desired outcome if called from a facility, but not from an organization.

The trouble I’m having in coming up with a solution is how to create a simple metric that can access both the time series spending and the value total area. There are a couple things that I can think of that will cut out the unwanted spending, but don’t capture it as missing %. I’m pretty sure it would have to be in a simple metric, because a compound metric runs into the same problems as the existing one.

Thanks for the help,
John


#2

For the spending simple metric, you could maybe create a similar simple metric that leverages a dot filter for facilities with grossFloorArea>0
Then for the grossFloorArea metric, grossFloorArea>0 ? grossFloorArea : 0