Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
k_west
Contributor
Contributor

Summing the Square of Data Grouped by Date

Hi!  I have a data set similar to the below example:

Date                      Company                 Orders

Dec 2016                   A                                  1

Dec 2016                   B                                  1

Jan 2016                   A                                  1

Feb 2016                   A                                  1

Feb 2016                   B                                  1

Mar 2016                   A                                  1      

 

I want to group the data by monthly orders, regardless of company to look like this:

Date                       Orders

Dec 2016                  2

Jan 2016                  1

Feb 2016                   2 

Mar 2016                   1      

 

Once I get that I want to find the sum square of the orders column.  For example 2^2 + 1^2 +2^2 + 1^2 = 10.

Is there a way to get that function from the original data?  I have tried several different methods but am not having much luck.  I use QlikSense.  Thank you!

Labels (3)
1 Solution

Accepted Solutions
sunny_talwar

May be this

Sum(Aggr(Sqr(Sum(Orders)), Date))

View solution in original post

5 Replies
sunny_talwar

May be this

Sum(Aggr(Sqr(Sum(Orders)), Date))
k_west
Contributor
Contributor
Author

I had done this same thing but used power(order,2) and it didn't work.  I wonder why just switching to sqr fixed it.

Thank you!

sunny_talwar

Did you do Power(order, 2) or Power(Sum(Order), 2)?

k_west
Contributor
Contributor
Author

I did Pow(order, 2)...

sunny_talwar

I think adding Sum() would have worked for you