16 Replies Latest reply: Mar 29, 2017 3:20 AM by Reinhold Graf

# Standard Deviation in a chart

Hi.

I need to calculate average and standard-deviation of stock-movements.

Average is calulated as following and working:

AVG(TOTAL Aggr(Sum([LV_M-Abgang-Gesamt]),[LV_JahrMonat/YearMonth]))

Standard-Deviation - actually no conclue. Tried a few approaches, but not working.

Target must be the standard-deviation related only(!) to the selected period.

Any idea ?

Regards,

Reinhold

• ###### Re: Standard Deviation in a chart

Did you try the Stdev() function? Stdev - chart function ‒ QlikView

Stdev(TOTAL Aggr(Sum([LV_M-Abgang-Gesamt]),[LV_JahrMonat/YearMonth]))

• ###### Re: Standard Deviation in a chart

yes. No output

I tried as well:

Stdev(TOTAL

aggr(

sum (

{<[LV_JahrMonat/YearMonth]={'>=\$(=min([LV_JahrMonat/YearMonth]))<=\$(=max([LV_JahrMonat/YearMonth]))'}>}

[LV_M-Abgang-Gesamt], [LV_JahrMonat/YearMonth]

)

)

)

Same Result...

• ###### Re: Standard Deviation in a chart

Would you be able to share a sample with the desired result?

• ###### Re: Standard Deviation in a chart

Yes.

The calculated standard-deviation (21.826) is the target.

I also watched the following blog:

• ###### Re: Standard Deviation in a chart

Can you attach the Excel here?

• ###### Re: Standard Deviation in a chart

attached

• ###### Re: Standard Deviation in a chart

I know this is just a sample, but Stdev seems to be working here... the only difference is that it is sample standard deviation rather than populations standard deviation... for population, may be look here:

Help with Standard deviation Full population No... | Qlik Community

• ###### Re: Standard Deviation in a chart

how does your formula for standard-dev. look like in this sample ?

• ###### Re: Standard Deviation in a chart

Stdev(TOTAL Value)

• ###### Re: Standard Deviation in a chart

OK for this example.

Coming to the management-requirement, there are some other problems to solve:

The table shows only 1 line per article, where stock-value, consumption, average and standard-deviation have to be shown and calculated according to several filters (period, divison, etc.)

In this case, the avg-/stdev-formulas have to be adjusted somehow, right ?

Pls see attachement, where avg/stdev are still calculated for the whole table.

• ###### Re: Standard Deviation in a chart

What is not right in the image? Can you point out? What do you expect to see?

• ###### Re: Standard Deviation in a chart

the red marked columns are wrong.

The values should be calculated   PER LINE

(and not for the whole table in sum. You can see, that the values are the same for each line)

In the end, the values in those columns should vary from line to line.

• ###### Re: Standard Deviation in a chart

What is the current expression used?

• ###### Re: Standard Deviation in a chart

AVG(TOTAL Aggr(sum([LV_M-Abgang-Gesamt]),[LV_JahrMonat/YearMonth]))

Stdev(TOTAL Aggr(sum([LV_M-Abgang-Gesamt]),[LV_JahrMonat/YearMonth]))

• ###### Re: Standard Deviation in a chart

I think you might need this

Stdev(Aggr(Sum([LV_M-Abgang-Gesamt]), Division, Lagerort, Artikelgruppe, [LV_JahrMonat/YearMonth]))

• ###### Re: Standard Deviation in a chart

OK. This works now.

Thanks a lot