Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
peter_put
Contributor
Contributor

Qlik duplicate record logic

When I load a table with identical records like:

Table:
load * inline [
Name, Age
Peter, 20
Peter, 20
Alice, 30
Alice, 30
]
;

And I display the chart, with sum(Age) I get 40 for the 2 Peters and 60 for 2 Alices.

When I add the following script line

inner join (Table) load distinct Age resident Table where Age = 20;

I keep the records for Peter however sum(Age) is now 20 instead of 40.

I can workaround the issue when I add RowNo() to the table to make the records unique but I don't understand why Qlik behaves like this.

Can someone please explain?

Kind regards,

Peter

1 Reply
ahaahaaha
Partner - Master
Partner - Master

Hi Peter,

Solving your problem as an variant

Table:

LOAD Distinct*;

load * inline [

Name, Age

Peter, 20

Peter, 20

Alice, 30

Alice, 30

];


In your code, all the same lines are summed up, and function RowNo() makes each line unique.

Regards,

Andrey