Tuesday, 10 July 2012

How to do weighted average in Teradata?

As per the definiton of weighted average, its is the sum of datapoints*weights / sum of weights. Hence each data point contributes to the average according to the weight associated to it.

For example: Table Fact_Balance_01 has columns
Book_Balance
,Term

To calculate a weighted average Balance_Term , we have

Select
    Term
    ,Sum(Book_Balance * Term)/Sum(NULLIFZERO(Book_Value))
From
Fact_Balance_01
Group by 1

How it helps?

Over a period, it gives us a graph. Also called the SMA graph.
It can be effectively used to see where your business is headed.


1 comment:

  1. Recomiendo totalmente https://calculadoradenotas.cl/ a cualquier estudiante, ya que es una página muy práctica, confiable y precisa para quienes necesitan saber su promedio o calcular cuánto les falta para aprobar.

    ReplyDelete

Please share your thoughts and let us know the topics you want covered