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: 
ecabanas
Creator II
Creator II

problem with 2 tables

    Hi all

I hve a different result reading the same data, I'm stuck and I need your fresh help

many thank's

Eduard

1 Solution

Accepted Solutions
morganaaron
Specialist
Specialist

Hi Eduard,

Not to drag this out, but there are.

This is taken from the table viewer (i.e. the underlying table your two values are coming from):

ModelProof.png

Have a look at your first four lines - they all have the same INVENTRANSID of 00538094-103. This is the same for all your values, there are 4 rows for every 'unique' line, therefore your values are being quadrupled.

Sort that, sort your problem.

View solution in original post

8 Replies
morganaaron
Specialist
Specialist

Eduard,

Can you give us more of an explanation? What data is reading incorrectly? What's the expected output? Not a lot to go on at the minute!

ecabanas
Creator II
Creator II
Author

Hi

If you open the doc you will see 2 tables:

a- Units fron transactionId: sum correctly: 9 units

b- Units from itemid:Sum incorrectly

both read the same info and I do not know why the units are different

thank's

stigchel
Partner - Master
Partner - Master

It's different because there are multiple distinct values for Unidades which are being summed in table b but not in table a. If you want table  b to display the same use

sum(DISTINCT UNIDADES)

ecabanas
Creator II
Creator II
Author

HI Piet,

I rechecked and the answer is not correct,please uncheck inventransid selection, just only itemid and the sum still is not correct

! Many thank's

stigchel
Partner - Master
Partner - Master

Can you try with

Sum(Aggr(sum(DISTINCT UNIDADES),INVENTTRANSID))

morganaaron
Specialist
Specialist

Hi,

There are multiple values for UNIDADES for each INVENTTRANSID. If you replace UNIDADES with Sum(UNIDADES) in your first table, you'll see your values quadruple - it looks like you have 4 values for every ID, therefore -36 is naturally four times higher than your -9 value when only summing one lot of the values.

ecabanas
Creator II
Creator II
Author

hI aARON,

The Inventtransid is an unique field, there is not many units for each inventtransid.

thank's

morganaaron
Specialist
Specialist

Hi Eduard,

Not to drag this out, but there are.

This is taken from the table viewer (i.e. the underlying table your two values are coming from):

ModelProof.png

Have a look at your first four lines - they all have the same INVENTRANSID of 00538094-103. This is the same for all your values, there are 4 rows for every 'unique' line, therefore your values are being quadrupled.

Sort that, sort your problem.