Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
l_smythe80
Partner - Contributor II
Partner - Contributor II

STD Deviation from an AGGR function.

Hi All,

im trying to create a std deviation calculation to show how far away from the price a certain customer is. 

so i have this logic:

=min({<Customer>} total <Customer> Aggr({<Customer>}If(PricePaid = FirstSortedValue({<Customer>} TOTAL <Customer> PricePaid, -Aggr(Sum({<Customer>}[Quantity]), Customer, PricePaid)), only({<Customer>}PricePaid)), Customer, PricePaid))

which finds by each customer the most frequent price each customer has paid for a particular product, as shown below an example:

Screenshot 2020-01-02 at 12.38.28.png

what i want to do is then create ST deviation for these results that are created in using the logic above.

 

is this something that i can incorporate into a Stdev expression?

 

2 Replies
Brett_Bleess
Former Employee
Former Employee

Maybe the following would work:

https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/New_Statistics_...

https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Statistics_Box....

Best I have, hopefully that may be of some help, if not, hopefully someone else that is better at development will be able to suggest something.  You could try the Design Blog area too, but I did some searching, was not finding much related to stats though...

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
lorenzoconforti
Specialist II
Specialist II

You just need to wrap your function in another aggregation and then calculate the standard deviation; please note you had some unnecessary set expressions in your formula which I've removed 

=Stdev(aggr(min(total <Customer> Aggr(If(PricePaid = FirstSortedValue( TOTAL <Customer> PricePaid, -Aggr(Sum([Quantity]), Customer, PricePaid)), only(PricePaid)), Customer, PricePaid)), Customer))