month_normalize()

Normalize the provided metric based on reference date and days.

Required arguments

NameTypeDescription
metricfloat8
reference_dateTIMESTAMPTZTimestamp to normalize the metric with
daysfloat8Optional, defaults to 365.25/12 if none provided

Sample usage

Get the normalized value for a metric of 1000, and a reference date of January 1, 2021:

  1. SELECT toolkit_experimental.month_normalize(1000,'2021-01-01 00:00:00+03'::timestamptz)

The output looks like this:

  1. month_normalize
  2. ----------------------
  3. 981.8548387096774