Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
New Contributor II

The table total is not the sum of individual rows

Hi Qlik Community!

I am hoping you could help me with a question... I have been doing a lot of research online, but wasn't able to find the answer to the question  -

I use Qlik Sense. I simply created a straight table. The total is not equal to the sum of individual rows. I am wondering why?

To give you a little background here -

I have an ODBC connection set up to Misrosoft SQL DB. There are 2 tables where I am pulling the information from: revenue and discounts. This is one-to-many relationship. One order may have 2 discounts.

For example, we have 1 order completed (Order1) for the total of $10 and 2 discounts (one is $5 and another one is $3). The below is how Qlik Sense records it in the table. Instead of summing $10 and $10, Qlik Sense recognizes somehow that it is one $10-dollar order and records $10 as the total.

How does Qlik Sense know not to add the rows up and recognizes what the right calculation is?

                    Revenue        Discount_Type         Discount_Amount

Order1        10                   A                              5

Order1        10                   B                              3

Total       10                                           8

Thank you for your help in advance!


2 Replies

Re: The table total is not the sum of individual rows

You have run into the sum-of-rows vs expression-total way of calculating sums/totals. It is for experienced Qlik developers well known that sum-of-rows most of the time will be equal to expression-total but not always. Qlik Sense and QlikView use expresion-total as default. That is why Qlik Sense does it correctly.

If you need to "fix" this in Qlik Sense you can use the Aggr-function.

Have a look at this article that is highly relevant to Qlik Sense although it is written with QlikView in mind:

Totals in Charts


Re: The table total is not the sum of individual rows


this is because the engine does the total calculation on the real table and not the display table