Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear All,
I am quite new to Qlik. I want to filter records (table A+B) based on the columns from both table A and table B.
After inner joining table A and table B by using col Key, I want to select only records with AMT within Range1 and Range2. May I ask if I want to do this in data load editor, what function should I use? Thank you
TableA:
| Key | Range1 | Range2 |
| 123 | 1 | 10 |
| 134 | 10 | 1000 |
| 185 | 5 | 8 |
| 199 | 7 | 200 |
TableB:
| Key | AMT |
| 123 | 5 |
| 134 | 290 |
| 185 | 46 |
| 199 | 35 |
After joining and filter Range1<=AMT<=Range2:
| Key | AMT |
| 123 | 5 |
| 134 | 290 |
| 199 | 35 |
Yiou can use IntervalMatch, which checks wether a value falls within a ragen, The script will then look something like this:
inner join([TableB])
IntervalMatch(AMT, Key)
LOAD
Range1
,Range2
,Key
Resident TableA;
Try this
TableA:
LOAD
Key,
Range1,
Range2
INLINE [
Key, Range1, Range2
123, 1, 10
134, 10, 1000
185, 5, 8
199, 7, 200
];
INNER JOIN (TableA)
LOAD
Key,
AMT
INLINE [
Key, AMT
123, 5
134, 290
185, 46
199, 35
]
WHERE AMT >= Ran
ge1
AND AMT <= Range2;
Try this
TableA:
LOAD
Key,
Range1,
Range2
INLINE [
Key, Range1, Range2
123, 1, 10
134, 10, 1000
185, 5, 8
199, 7, 200
];
INNER JOIN (TableA)
LOAD
Key,
AMT
INLINE [
Key, AMT
123, 5
134, 290
185, 46
199, 35
]
WHERE AMT >= Ran
ge1
AND AMT <= Range2;
This would do.
TableA:
LOAD
Key,
Range1,
Range2
INLINE [
Key, Range1, Range2
123, 1, 10
134, 10, 1000
185, 5, 8
199, 7, 200
];
TableB:
LOAD
Key,
AMT
INLINE [
Key, AMT
123, 5
134, 290
185, 46
199, 35
];
IntervalMatch (AMT)
LOAD
Range1,
Range2
RESIDENT TableA;
Inner Join (TableA)
LOAD
Key,
AMT
RESIDENT TableB;
FinalTable:
LOAD
Key,
AMT
RESIDENT TableA;
DROP TABLE TableA;
DROP TABLE TableB;