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: 
Not applicable

Replace value if another table value exists?

FactTable:

IDAmount
125
230

DimTable:

ID

Type
1A
1B

2

A
2C

In the script, I want to replace Amount with 0 if any of its types are B, else leave it alone, resulting in:

NewTable:

IDAmount
10
230

How can I do this?

1 Reply
MayilVahanan

Hi

Try like this

FactTable:

Load * Inline

[

ID,Amount

1,25

2,30

];

DimTable:

Load * Inline

[

ID,Type

1,A

1,B

2,A

2,C

];

Inner Join(FactTable)

Load ID,Concat(Type,',') as Type Resident DimTable Group by ID;

Test:

NoConcatenate

Load ID,Type, If(WildMatch(Type,'*B*'), 0, Amount) as Amount Resident FactTable;

DROP Tables DimTable, FactTable;

PFA

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.