Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
wlabarca99
Contributor III
Contributor III

Nested Aggregation - Sum/Total of another Expression

Hello,

I am trying to create a straight table that displays a linear regression calculated by hand where the x-axis is Weeks Ago and the y-axis being Qt Sold.  Below is a screenshot of how far I have gotten to this point:

LinReg.PNG

I need to TOTAL or SUM the last column (x-xBar)(y-yBar) which contains the following expression:

([ord_dt.autoCalendar.WeeksAgo]-(Avg(TOTAL([ord_dt.autoCalendar.WeeksAgo]))))

*

((Sum(qt_ordd))-(Avg(TOTAL(qt_ordd))))

The catch is, I need to get that total or sum for all records... A simple example is below.

Weeks Ago(x-xBAR)(y-yBAR)SUM((x-xBAR)(y-yBAR))

0

-5

15
1-215
2115
3615
4715
5815

If anyone can help with this it would be great!

1 Solution

Accepted Solutions
sunny_talwar

May be this

Sum(TOTAL Aggr(

([ord_dt.autoCalendar.WeeksAgo]-(Avg(TOTAL([ord_dt.autoCalendar.WeeksAgo]))))

*

((Sum(qt_ordd))-(Avg(TOTAL(qt_ordd))))

, [Weeks Ago]))

View solution in original post

2 Replies
sunny_talwar

May be this

Sum(TOTAL Aggr(

([ord_dt.autoCalendar.WeeksAgo]-(Avg(TOTAL([ord_dt.autoCalendar.WeeksAgo]))))

*

((Sum(qt_ordd))-(Avg(TOTAL(qt_ordd))))

, [Weeks Ago]))

wlabarca99
Contributor III
Contributor III
Author

Thank you Sunny!  It worked!