docs icon indicating copy to clipboard operation
docs copied to clipboard

[Feedback] Page: /api/latest/hyperfunctions/month_normalize/

Open nicolasembleton opened this issue 1 year ago • 3 comments

Is it easy to find the information you need?

No

Are the instructions clear?

Yes

How could we improve the Timescale documentation site?

Apologies if I'm dense but what does "normalize" mean in this context? Can't make sense of this. Why is 1000 for 01/01/2021 suddenly becomes 981.xxx when normalized?

nicolasembleton avatar Oct 27 '24 08:10 nicolasembleton

Thank you for the report. We welcome documentation contributions!

  • For information about how to propose a change, see the contributing guide in our GitHub repository.
  • For information on style and word usage, see the style guide

github-actions[bot] avatar Oct 27 '24 08:10 github-actions[bot]

@mkindahl , any chance you could give me a one liner about what normalize means in https://docs.timescale.com/api/latest/hyperfunctions/month_normalize/. I found https://www.postgresql.org/docs/current/datatype-datetime.html but it seems like a long read :-).

billy-the-fish avatar Oct 29 '24 10:10 billy-the-fish

The function month_normalize is intended to translate a metric to a "standard month" of 365.25/12 days, so that you can compare two month and decide, e.g., which one is better. As an example, consider the following metrics for a few months:

Month Sales
Jan 3000
Feb 2900
Mar 2900

In this case it looks like January was the best month, but if you normalize this, you get the following result:

Month Normalized Sales
Jan 2945.56
Feb 3152.46
Mar 2847.38

So it turns out that the better month was actually February. This is because February have just 28 days (in this example) and the other months have 31 days. For that reason, since the month is shorter, it has a better outcome.

It could equivalently be defined as "income per day times 365.25/12 or the value of 'days'".

mkindahl avatar Oct 30 '24 12:10 mkindahl