Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgarg
Specialist II
Specialist II

What is the difference between : (Expression Total) and (Sum Of Rows) ?? in expression tab ??

Hey,

What is the difference between :

(Expression Total) and (Sum Of Rows) ?? in expression tab .

Please tell with help of example.

thanks

5 Replies
anbu1984
Master III
Master III

Not applicable


Hi,

Here Expression total it will give total sales value but sum of rows here we need to limit the rows then it will give result for that limited rows.

Gysbert_Wassenaar

If you use avg(MyField) as expression then the expression total will be the average of all MyField values. But the sum of rows will be the sum of the averages. And that is something completely different.

Key,Value

A, 1

A, 3

B, 5

C, 7

C, 9

Key, avg(Value)

A,2

B,5

C,8

Expression total: average of 1,3,5,7,9 = 5

Sum of rows: 2+5+8 = 15


talk is cheap, supply exceeds demand
Not applicable

QV.JPG.jpg

If you choose Sum Of Rows, the rows are just added.

If you choose Expression Sum, Qlikview uses the expression used to calculate the Total.

simenkg
Specialist
Specialist

if you have a fact table with three rows and one dimension table:

Fact:
load * inline [

ID, %MarketKey, Value

1, 1, 100

2, 2, 200

3. 2, 300

];

DimMarket:

load * inline [

%MarketKey, Market

1, South East Asia

1, Europe

2, Americas

];

When you have a table with Market as dimension it will be as follows:   

Market                    Count(Distinct ID)     Sum(Value)

South East Asia          1                         100

Europe                        1                         100

Americas                    2                         500

Sum of Rows              4                         700

Expression total           3                         600

If you use Sum of Rows you would get Count(Distinct ID) = 4 and Sum(Value) = 700 allthough we know that the total is in fact 3 and 600.

Expression total evaluates the expression over the whole dimension Market and would return Count(Distinct ID) = 3 and Sum(Value) = 600