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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
doyleax123
Partner - Contributor
Partner - Contributor

Sum of Variable isn't returning a total sum

I have a measure, Amt, with 12 values (1 for each year).

I created a variable for Amt, (because for some reason nothing would work with calling the measure directly)

e_Amt = Above(sum([Amt],0,1))  // returns 12 values  << If there is a better way to get all values in a measure, I'd love to know. I tried just calling [Amt] for the variable and that didn't work.

More variables:

3yrMA                  = rangeavg(above(sum[Amt]),1,3)) // returns 11 values

3yrMA_Resid       = $(e_Amt)-$(e_3yrMA) // returns 11 values

3yrMA_ResidSqr = sqr($(3yrMA_Resid)) // returns 11 values

3yrMA_RSS = sum($(3yrMA_ResidSqr)) // returns nothing

3yrMA_RSS = sum("$(3yrMA_ResidSqr)") // returns zero

I want the RSS to be the sum of all of the squared residuals, but as noted above, my attempts are unsuccessful. Any help would be appreciated.

3 Replies
sunny_talwar

How about this

3yrMA_RSS = Sum(3yrMA_ResidSqr)

doyleax123
Partner - Contributor
Partner - Contributor
Author

Since 3yrMA_ResidSqr is a variable, doesn't it need to be referenced like $(3yrMA_ResidSqr) ?

sunny_talwar

That is not necessary.... have you given it a try?