Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
jumuravchik
Contributor II
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!

Julia

2 Replies
petter
Partner - Champion III
Partner - Champion III

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

lironbaram
Partner - Master III
Partner - Master III

hi

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