Scaling values on metric evaluation


I have PointMeasurement data of different scales (i.e. different unitConstraint in the corresponding PointPhysicalMeasurementSeries). e.g. for object id1 they are between 0 and 1, while for object id2 they are between 0 and 100.

When I evaluate a metric of the following form:

  "ids": [
    "id1", "id2", "id3", "id4"
  "expressions": ["MyMetric"],
  "interval": "QUARTER_HOUR",
  "start": "2018-02-21T00:00:00.000-00:00",
  "end": "2018-02-28T00:00:00.000-00:00"

I see the graph mixes values between 0 and 100, with values between 0 and 1!

How I can ensure all values are scaled to 0 and 1?



If the values have the right units set on each data point the engine will automatically convert the values to the desired unit for you. For e.g.

If the header specifies the desired unit to be “kilowatt”

PointPhysicaMeasurementSeries.make( {
  unitConstraint: {id:"kilowatt"}

And individual data points are a mix of various units, let’s say “kilowatt” & “watt” then each data point will be converted to “kilowatt” and normalized

  parent:{id : "test1"}, start:"2010-01-01", 
  quantity: {value:1, unit: {id: "kilowatt"}}
  parent:{id : "test1"}, start:"2010-01-02", 
  quantity: {value:1000, unit: {id: "kilowatt"}}

On day 1 value is : 1 kilowatt and on day 2 value is: 1000 watt, then based on the unitContraint specified on the tsField, all values will be converted to “kilowatt” and value for day 2 will be stored as “1 kilowatt”

you can specify the unitConstraint on the time series field as follows:

type PointMeasurement mixes ... {
  quantity: ExactDimension
1 Like


Thanks @rohit.sureka, so in my case I need to remix PointMeasurement to add the unitConstraint and also set one unique unitConstraint in the series header (i.e. PointPhysicalMeasurementSeries).

What should I use so that the values will be scaled between 0 and 1, is there a unit for this?



in your case, simplest would be to handle it in the metric expression, something like:

MyMetric > 1 && MyMetric < 100 ? MyMetric / 100 : MyMetric

1 Like


Thanks @rohit.sureka , I thought of this solution but was thinking of creating a unit (as I can’t find unit for [0-1]) e.g. probability. Then find a way to define an automatic conversion like with watt and kilowatt in your example above.
Is this possible?



probability is not a unit of measure so in this case I would say it would be wrong to create a unit called probability

1 Like


I know @rohit.sureka, that’s just a name. What I want is define the conversion from % to this new unit.

Is this possible?



yes, that is possible



Can you point to how I can achieve this?