Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
jworthulf
Creator
Creator

sum does not equal total

I have two fields in a table and I have made selections in field one (text) values that have associated values in field 2.     When I go, to sum up the values of the fields that I've selected using sum(field) and my total is incorrect.  

Example

fields selected in a list box are B,C,D

Table 1

                    sum(Field2)

Field 1          Field 2

B                    5

C                    4    

D                    3

                                            

                      6 = Total

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You are probably experiencing an issue caused by the difference between a sum-of-rows and expression total evaluation of your expression in the total line.

This may rise up e.g. with a little more complex data model:



Facts:

LOAD * INLINE [

    Dim, Key

    A, 1

    A, 2

    B, 1

    C, 2

    D, 3

    E, 1

    E, 2

    E, 3

    F, 4

];


Numbers:

LOAD * INLINE [

Key, Number

1, 1

2, 2

3, 3

4, 4

];

Then creating a straight table with dimension Dim and two expressions (both = Sum(Number) but with different total mode):

Dim sum of rows expression total
B11
C22
A33
D33
F44
E66
19 10

View solution in original post

30 Replies
vishsaggi
Champion III
Champion III

Can you share a screen shot or sample file you have this issue?

jworthulf
Creator
Creator
Author

I'm sorry this is all I have to offer.

Are there any data modeling issue that could possibly create a situation like this?

vishsaggi
Champion III
Champion III

use a text object and do sum(Field2) then select values from field 1 and see if the sum totals up?

vishsaggi
Champion III
Champion III

I cannot say anything unless you show me some screenshots or sample of what your data model is and your chart object you are trying to display your total.

jworthulf
Creator
Creator
Author

Vishwarath,

Here's an example of what I was looking at, instead of summing to 52 as the example shows the sum total was 39. What would create this type of issue?

John Worth

BI Data Analyst

Upper Lakes Foods

p: 800.879.1265 ext 4278

w: upperlakesfoods.com<http://upperlakesfoods.com/>

vishsaggi
Champion III
Champion III

This is what i can see when i open your test file and sum is calculated correctly which is 52? Is it somethin else i need to look at?

Capture.PNG

jworthulf
Creator
Creator
Author

what would create a sum of 39. I'm not able to replicate this in the example but it came up on test question today. Logically looking at the numbers I would assume that it did not sum the last number 13...but I'm not sure why or what would cause something like this to happen.

John Worth

BI Data Analyst

Upper Lakes Foods

p: 800.879.1265 ext 4278

w: upperlakesfoods.com<http://upperlakesfoods.com/>

vishsaggi
Champion III
Champion III

Can you screenshot the data model where you have this issue? Not sure why?

jworthulf
Creator
Creator
Author

Unfortunately, I'm not able to do that, the question is a hypothetical one at best as I do not have access to the all the script data that created the outcome of 39 vs 52.

What I showed you in my example above is what I was given with some multiple choice options in terms of the answer.    I'm assuming there must be something in the design, data model, or UI that is creating this issue.    The measure was very straightforward.

Thanks for taking a look.