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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
b4Xt3r
Contributor
Contributor

Difference in sum

Hi,

I am migrating a QlikView dashboard to PBI, and I see that this formula is not a simple formula:

SUM(a*b) 

so if you have SUM(2*3) the result wont be 6 ... to get the six I need to use SUM(a)*Sum(b) ... so why doews  SUM(a*b)  is different? 

Labels (1)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

It looks like you are aggregating both on dimension level an on total. Let me extend @Or's example.

Dim,a, b

X, 2, 3

X, 2, 2

Y, 5, 10

Y, 1, 30

A table with sum aggregations might look like this. 

Dim1, Sum(a), Sum(b), Sum(a)*Sum(b),Sum(a*b)

X, 4, 5,  20,  10

Y, 6, 40, 240, 80

Total, 10,45,450,90

 

Consider sum(a)*sum(b) as if you take the product of the row value of the two aggregations. Consider the sum(a*b) as the sum of a*b per data row

View solution in original post

3 Replies
Or
MVP
MVP

For the rows:

a, b

2, 3

5, 10

Sum(a*b) =(2*3) + (5*10) = 56

Sum(a) * sum(b) = (2+5) * (3+10) = 91

b4Xt3r
Contributor
Contributor
Author

here is the thing: I have this in Qlik

b4Xt3r_0-1630097893222.png

Result= SUM(A*B) but why? ... Result is the value that the client need so I need to understand to logic behind sum(a*b) :

 

sum({$<Indicador={'Estructura de la Deuda'}>} [Saldo al momento Sin Comisiones Dlls] * [Tasa Credito2])

 

 

Vegar
MVP
MVP

It looks like you are aggregating both on dimension level an on total. Let me extend @Or's example.

Dim,a, b

X, 2, 3

X, 2, 2

Y, 5, 10

Y, 1, 30

A table with sum aggregations might look like this. 

Dim1, Sum(a), Sum(b), Sum(a)*Sum(b),Sum(a*b)

X, 4, 5,  20,  10

Y, 6, 40, 240, 80

Total, 10,45,450,90

 

Consider sum(a)*sum(b) as if you take the product of the row value of the two aggregations. Consider the sum(a*b) as the sum of a*b per data row