Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
New Contributor III

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
Highlighted
MVP
MVP

Re: sum does not equal total

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

29 Replies
Highlighted
Esteemed Contributor III

Re: sum does not equal total

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

Highlighted
New Contributor III

Re: sum does not equal total

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

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

Highlighted
Esteemed Contributor III

Re: sum does not equal total

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

Highlighted
Esteemed Contributor III

Re: sum does not equal total

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.

Highlighted
New Contributor III

Re: sum does not equal total

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/>

Highlighted
Esteemed Contributor III

Re: sum does not equal total

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

Highlighted
New Contributor III

Re: sum does not equal total

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/>

Highlighted
Esteemed Contributor III

Re: sum does not equal total

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

New Contributor III

Re: sum does not equal total

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.