Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to compare 2 fields using SET ANALYSIS ?

I am actually trying to see how I can compare fields from  2 different tables using SET ANALYSIS.

Table1:

Id            Name

100         JOHN

101         JAKE

102         MIKE

104         AMY

Table2:

Name                    Amt

MIKE                      200

AMY                       500

BOB                       300

In my output I want something like :  SUM({$<Table1.Name = Table2.Name>} Table2.Amt) but this is not working.

Can someone please provide the correct syntax for doing this comparison (without using an IF statement, since that’s very memory intensive) ?

Also, please don't suggest the joining of the 2 tables in the script itself, since my example is just a very simplified version of the real one.

Thanks.

12 Replies
walidhussein
Creator
Creator

First you need to pass the value from Table1.Name into a variable, then you need to use this value in your set analysis expression. Like this example:

=SUM({<Table2.Name = $(=Variable)>} Table2.Amt)

this way is the simplest way to use with Island tables in your data model. I hope this is helpful.

Thanks and regards,

Walid

walidhussein
Creator
Creator

Please let me know if this was helpful.

Thanks

wu_zheng
Contributor
Contributor

Hi Walid,

If possible to pass multiple values from table 1 (island tables in my data model), do the comparison with table 2  columns, and if it meets certain criteria, then get selected values in table 1? thanks for your help.

Steven