Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am attempting to write an expression that will run an average and Standard Deviation*3 for every Code and only return the total Days that are below that Codes sum(Avg+StDev*3). The expression is working but I am not getting the desired result it is evaluating the Standard Deviation for the entire set instead of each Code. In the end I need a KPI that has the total days from each Code bucket.
Sum({<Value={"<=$(=(Sum(Value)/count(distinct Key)) + (StDev(Aggr(Sum(Value)/Count(distinct Key), Code, Key))*3))"}>}Days)
$(= anything) creates an adhoc-variable which is evaluated once before the chart is calculated and there applied to each row. You could try to change your expression in this way:
Sum({<Days={"=Value<=(Sum(Value)/count(distinct Key)) + (StDev(Aggr(Sum(Value)/Count(distinct Key), Code, Key))*3)"}>}Days)
- Marcus
It is a great thought, and is why I was getting a flat number instead of an adjustable number based on the code, but it didn't solve my issue. The calculation is still not correct.
Just ensure that each expression-part of the condition returned the expected results within your object. This means to create further calculations for:
Sum(Value)
count(distinct Key)
StDev(Aggr(Sum(Value)/Count(distinct Key), Code, Key))*3
If not they might need further set analysis and/or TOTAL statements and/or different dimensions within the aggr().
- Marcus