Hi,
Imagine a table of sales data with each row containing the sales date and the amount sold.
My goal is to calculate the standard deviation of monthly sales (and use this value in other formulas).
Getting the monthly sales is easy:
DIM: ROUND_MONTH(SALES.DATE), KPI: SUM(SALES.AMOUNT)
In order to STDEV over those monthly values, I thought about doing the monthly sum within a PU function like so:
PU_SUM(DOMAIN_TABLE(ROUND_MONTH(SALES.DATE)), SALES.AMOUNT))
In my understanding of PU functions, I would've thought that this results in the same values as DIM: ROUND_MONTH(SALES.DATE), KPI: SUM(SALES.AMOUNT).
But it does not, the values are roughly 10 times as high, each "month" is higher than the sum of all amounts together.
In the end I want to be able to use a formula to get the STDEV and use this to calculate other KPIs
Thanks in advance