Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
shirleyk
Contributor II
Contributor II

Replace if statement with set analysis

Hi all,

I  have two isolated tables which contain a key logically link to each other (ID1 & ID2).

DataA:
Load * inline [
ID1, Value1
A, TestA
B, TestB
C, TestC
];

DataB:
Load * inline [
ID2, Value2
A, TestX
B, TestY
C, TestZ
];

 

My expected result table is like this:

ID1   Value1   Value2

A       TestA      TestX

B       TestB      TestY

C       TestC      TestZ

 

It can be done by using this expression in columne Value2.

=aggr(only(if (ID1=ID2, Value2)), ID1)

However, due to performance issue (actually no. of records is more than 10 thousands), may i know if it is possible to change the if statement to set analysis?

I have tired the followings but it only works when one ID1 is selected.

=aggr(only({$<ID2={'=ID1=ID2'}>} Value2), ID1)

 

Thanks a lot,

Shirley

4 Replies
bramkn
Partner - Specialist
Partner - Specialist

ID2=p(ID1)
Gysbert_Wassenaar

Rename field ID2 to ID1.

talk is cheap, supply exceeds demand
shirleyk
Contributor II
Contributor II
Author

Thanks for the prompt reply.
Due to some restrictions, i cannot rename to associate these 2 fields together in data model. The logic can only be implemented via UI.

shirleyk
Contributor II
Contributor II
Author

Thanks for the suggestion.

Tried ID2=P(ID1), but seems still doesn't work.