Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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

Re: Replace value if another table value exists?

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

Community Browser