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: 
jumiprado
Creator
Creator

Compare values in two tables

hi all!

I need to create a script where count the rows in table_1 and table_2, then i need to compare the two tables and show the differences.

For example:

Table_1

IDNameDateCity
10001Name_101/01/2016NY
10011Name_210/12/2016WA
10101Name_311/11/2015NY
10101Name_400/00/0000

Table_2

IDNameDateCity
10002Name_601/01/2016NY
10016Name_710/11/2016AL
10101Name_311/11/2015NY
10101Name_400/00/0000
20011Name_2302/02/2014WA

I need two tables as a result:

TableRows
Table_14
Table_25

and a table with the rows dont match

IDNameDateCityTable
10001Name_101/01/2016NYTable_1
1011Name_210/12/2016WATable_1
20011Name_2302/02/2014WATable_2

Thanks!!!

1 Reply
jonathandienst
Partner - Champion III
Partner - Champion III

First load the two table with a source indicator

LOAD ID,

  Name,

  Date,

  City,

  'Table1' as Source

FROM .... table 1

Concatenate

LOAD ID,

  Name,

  Date,

  City,

  'Table2' as Source

FROM .... table 2

For the first result, use Source a the dimension and Count(ID) as the expression.

For the second, use ID, Name, Date, City as dimensions, and If(Count(Distinct Source) = 1, 1, 0) as the expression. Ensure suppress zeroes is checked on the presentation tab and hide the expression column.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein