Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

conditionnal join

Hi experts,

I would like do a conditionnal join.

Table A (ID1,F1,...)

Table B (ID2,ID3,...)

if F1  =1 then link On ID1=ID2 else ID1=ID3.

Do you know if it's possible?

I have 2 fact in 1 table link on the same dimension but not on the same dimension granularity .

Eva

3 Replies
deepakk
Partner - Specialist III
Partner - Specialist III

hi,

Try this method,

Load * , ID3, ID2 from FACT1;

Load *, ID1 as ID2  from Fact2 where F1= 1; 

In the above case the ID1 of Fact2 table where F1=1 will get linked to the ID2 of Fact1 table.

Load *, ID1 as ID3  from Fact2 where F1<> 1; 

In the above case the ID1 of Fact2 table where F1<> 1 will get linked to the ID3 of Fact1 table.

The above reult will create three tables.You can use the join fucntion to join these tables and make it one table

Deepak

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Try with this approach.

     TableA:

     Load ID1,F1 From Datasource where F1=1;

     TableB:

     Load ID1,F1 From Datasource where F1<>1;

     Left Join(TableA)

     Load

          ID2 as ID1,

          ID2,

          ID3

     ..From..

     Left Join(TableB)

          ID3 as ID1,

          ID2,

          ID3

          ..From..

Hope it Helps

Celambarasan

Not applicable
Author

Hi,

Thanks for you help maybe my question is not very clear, so I build an example below .

for the first solution : the issue it's the join between Fact1 and others table is on ID2 AND DI3. but I need ID2 OR ID3.

the second doesn't works neither :'(

 

Another way to say that it's if ID3 exists link with it. If not link with ID2

I build a field D1 with tihs formula: if (F1 ='run' ,ID3, ID2 )