Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

sum problem

Dear all
i have to count how many records in table A are in table B (for each year).

i have creted a resident table whith this script


table_a:

load TMP_KEY AS MATCH_KEY,
BARCODE_MATCH_OR AS MATCH_BARCODE_OR,
BARCODE_MATCH_AR AS MATCH_BARCODE_AR,
ANNO,
IF(BARCODE_MATCH_OR=BARCODE_MATCH_AR,NUM(1),NUM(0)) AS MATCH_CONTA
RESIDENT
MATCHATI_TMP;

TMP_KEY BARCODE_MATCH_AR BARCODE_MATCH_OR ANNO MATCH_CONTA
431525 431525 431525 2010 1
431867 431867 431867 2010 1
431915 431915 431915 2010 1
434535 434535 2010 0


the table_a contain 19663 records.

whith a pivot table i could sum the "match_conta" value .
I use the dimension ANNO but the result is wrong.

I don't understand why the sum(match_conta) return 106506

Someone can help me.

Many Thanks
Riccardo

1 Solution

Accepted Solutions
mantaq10
Contributor III
Contributor III

HI,

Can you post your app?

View solution in original post

5 Replies
pover
Luminary Alumni
Luminary Alumni

Riccardo,

To match the 2 tables are you doing a join? If so, I would make sure that the join is not wrongly duplicating the rows.

Regards.

Not applicable
Author

Hi Karl,

yes i have done a join for optimize

but ... If i display all fields for the target table with an ordinary table the system show me 19663 records, 11616 of these have the

fields "match_conta" = 1 .

So i suppose to have a value like 11616 for year ...

I'm not so expertize .. so i probably doing a mistake...

Many thank's Riccardo

mantaq10
Contributor III
Contributor III

HI,

Can you post your app?

Not applicable
Author

Hi ,

yes of course .. and many thank's ..

Riccardo

Not applicable
Author

Dear all

i have found the mistake!!!

i counted the null value .. 😞

Sorry !! and thank's for helps