Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgarg
Specialist II
Specialist II

Difference between Sum(Price) or Total(Price) ??

Hello,

I have 3 fields :

ID_No , Price , Department.

Now if i want sum of price i do:

Sum(Price) or Total(Price).

What is the difference between :  Sum(Price) or Total(Price)

Thanks

13 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi Nikhil,

For getting Sum of Price use

=Sum(Price), when you use this you will get the dimension wise price values

For ex:

Country,      Sum(Value)

India, 10000

Srilanka, 5000

If you Sum(Total Value), it ignores the dimensions and displays sum of value in all rows for the above example

Country,      Sum(TOTAL Value)

India, 15000 (10000 + 5000)

Srilanka, 15000 (10000 + 5000)

Hope this helps you

Regards,

jagan.

anbu1984
Master III
Master III

There is no function named Total. Do you mean Sum(Price) vs Sum(Total Price)?

nikhilgarg
Specialist II
Specialist II
Author

HEy,

If i am using AVG(). Let Say:

Avg(Sum(Price)) and Avg(Total Price) , Then what is the difference ??

Thanks

nikhilgarg
Specialist II
Specialist II
Author

HEy,

If i am using AVG(). Let Say:

Avg(Sum(Price)) and Avg(Total Price) , Then what is the difference ??

Thanks

anbu1984
Master III
Master III

Load * Inline [

OrderId,Date,Amount

1,1/1/2014,200

1,1/1/2014,100

2,1/1/2014,300

2,1/1/2014,400

];

Dimension is OrderId

Avg(Amount) for OrderId 1 is (100+200)/2 = 150

Avg(Total Amount) - (100+200+300+400 )/4=250 -- Total ignores dimension and calculates Avg for entire table

Avg(Amount) for OrderId 2 is (300+400)/2 = 350

Avg(Total Amount) - (100+200+300+400 )/4=250

nikhilgarg
Specialist II
Specialist II
Author

Hey,

But i have asked for :

Avg(Sum(Price)) and Avg(Total Price)


And you ahve told me about :

Avg(Price) and Avg(Total Price)


So, does that mean : Avg(Sum(Price)) and Avg(Price) are same ??

jagan
Luminary Alumni
Luminary Alumni

Hi,

You will get error if you use =Avg(Sum(Amount)), you cannot use two Aggregation functions, so Avg(Price) is valid.

Hope this helps you.

Regards,

Jagan.

nikhilgarg
Specialist II
Specialist II
Author

HEy,

So it means ,

If i use Avg(Price): It will give me Avg as per dimension that i have selected on X-Axis

If i use Avg( Total Price): It will give me Avg irrespective of dimensiont hat i have used on X-Axis.

Right ??

And if  i use Avg(Total Price) and select a dimension, then i have read somewhere that it will give dimensionwise Avg . Right ???

jagan
Luminary Alumni
Luminary Alumni

Hi,

Let us take one example,

Dept, Sales

1, 100

1, 200

2, 300

4, 400

In chart if you have Dept as Dimension,

If you use Avg(Sales) then you will get

Dept, Avg(Sales)

1, 150    ---------------(100 + 200)/2 = 150

2, 300

4, 400

If you use Avg(TOTAL Sales) then you will get

Dept, Avg(TOTAL Sales)

1, 250

2, 250

4, 250  -- Since TOTAL ignores dimension, you will get (100 + 200 + 300 + 400)/ 4 = 250 for all dimension values.

Hope this helps you.

Regards,

Jagan.