Forum Discussion
Anonymous
7 years agoNot applicable
Calculated Column - Standard Deviation (NOT a Measure)
Hi All,
I need to calculate the average and standard deviation over a large number of records as a calculated column.
I've created a calculated column which provides the 6 week average of sales for each day.
I need to create another column that selects the same records and provides the standard deviation. I tried to just change the average to stdev.p but that didnt work.
With those two values in hand for each transaction I will create a future supply projection for each transaction.
I have this working in a summarize statement in a calculated table but would really like to do it in a calculated column to avoid having to join the result back to the main fact table as the cardianlity of that join is the entire record set.
FutureProjection=IFERROR(NORM.INV(0.98,'Fact'[Mean],'Fact'[STDV]),0)
Mean = VAR _Date =
DATEADD ( 'FACT'[Date], -7, DAY )
RETURN
CALCULATE (
ROUNDUP(AVERAGE( 'FACT'[COLQty Sales] ),0),
ALLEXCEPT ( 'FACT', 'FACT'[Key] ),
'FACT'[Complete] = "COMPLETE",
DATESINPERIOD ('Calendar'[Date],_Date,-42,DAY))
)No Replies