Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
nbuchholz1
Contributor II
Contributor II

Stdev() on data for row value not entire dataset

Hi All - I'm trying to use the stdev() function but am struggling to apply it to meet our needs. 
Here is a sample data that is similar to our data structure, we have a product, a week, and the total sales. 

I'm trying to identify the standard deviation of product sales across the all weeks excluding the current week for each product, lets assume current week is week 5. 
Using the following formula in my straight table:   stdev({<Week<={3}>}Sales), I can only get the stdev of all sales for that specific week range. 

Can anyone help me figure out how to return the standard deviation across weeks for each product? Thanks so much!

 

ProductWeekSales
Product 1Week 11000
Product 2Week 12000
Product 3Week 13000
Product 1Week 21400
Product 2Week 22001
Product 3Week 24920
Product 1Week 31892
Product 2Week 33892
Product 3Week 32378
Product 1Week 49772
Product 2Week 4781
Product 3Week 43922
Product 1Week 53888
Product 2Week 53789
Product 3Week 51999
Labels (2)
1 Solution

Accepted Solutions
dirk_fischer
Creator II
Creator II

Try using the Aggr function - you may not have the week in your table, then you get the Standard Deviation per product.

=Aggr({<WEEK={"<=3"}>}
    StDev({<WEEK={"<=3"}>}SALES),
          PRODUCT
         )

View solution in original post

1 Reply
dirk_fischer
Creator II
Creator II

Try using the Aggr function - you may not have the week in your table, then you get the Standard Deviation per product.

=Aggr({<WEEK={"<=3"}>}
    StDev({<WEEK={"<=3"}>}SALES),
          PRODUCT
         )