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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Simple SUM() question

This might be a silly question but I was wondering,

Is there a difference between

Sum(A) + Sum(B)

OR

SUM(A + B)

The result returned are the same, since I am dealing with +60M records I was wondering are there performance issues involved ...

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

in a straight table you are able to choose a "Total Mode". Unfortunately in a pivot table not.

So you have to be careful in writing your expressions.

"Expression Total" or "Sum of Rows" could be end in different results.

Rainer

View solution in original post

6 Replies
Not applicable
Author

I do not know the exact internal difference in the QlikView algorithms. but I'm almost sure that sum (A) + sum (B) returns the same thing than sum (A+B) in terms of results.

In terms of performance just try both solutions : load you 60 M of line.
Look the results in terms of RAMs and in terms of time and choose the best solution. You can use the QlikView Server Performance application (download it here http://demo.qlik.com/ ) to analyse the .mem files (you can create a .mem statistics files by clicking on settings / document properties / General / Memory settings button.

Regards

Not applicable
Author

Hi,

there could be a difference. It depends on your data.

See the screenshot.

Rainer

Not applicable
Author

Any Idea why they not the same ? is it something to do with rounding ?

Anonymous
Not applicable
Author

This actually scares me a little bit. Mathematically there is no difference in the two methods, but the sample table you provided, there is quite a difference. I also show that there is some difference in the two methods, although I do not show as great of differences but at only 13 million lines. Here is my verification table:

I would love to see another example from another larger (50 million +) record data set. I would recommend sticking with Sum(A) + Sum(B) to be able to reconcile your results.

Thanks,

JS

Not applicable
Author

Hi,

in a straight table you are able to choose a "Total Mode". Unfortunately in a pivot table not.

So you have to be careful in writing your expressions.

"Expression Total" or "Sum of Rows" could be end in different results.

Rainer

Not applicable
Author

Hi,

I have done the same as you with our data set, around 50M records. Like yourselves mine is slightly out, I have attributed this to rounding since one of the figures goes to 7 decimal places. With 50M records it was less than .5. I can't seem to work out how to paste picture so I can't show you the table !!