Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

tiklam_dynasys
Contributor

How to compare value in different table and without key

Hi All,

I got some questions on comparing value in different table.

Table A

Key
Value
110
220
330

Table B

Lower RangeUpper RangeClass
1020Y
2030Y
010N

I would like to ask how to check which Key in table A belong to Class Y in Table B

Best Regards,

Louis

4 Replies
sushil353
Honored Contributor II

Re: How to compare value in different table and without key

Hi,

TableA:

Mapping load * inline

[

Value,Class

10,Y

20,Y

30,Y

];

TableB:

load ApplyMap('TableA',Lower Range,'N') as Class,* inline

[

Loser Range,Upper Range

10,20

20,30

0,10

];

HTH

Sushil

tiklam_dynasys
Contributor

Re: How to compare value in different table and without key

Thx for reply!

The column Class does not exist in Table A.

sushil353
Honored Contributor II

Re: How to compare value in different table and without key

Try this


TableA:

Mapping load 'Y' as Class,* inline

[

Value

10

20

30

];

MVP
MVP

Re: How to compare value in different table and without key

Use an interval match in the pattern:

Let epsilon = 1e-9;

A:

LOAD Key,

  Value

FROM ...table A...

Left Join (A)

IntervalMatch(Value)

LOAD [Lower Range],

  [UpperRange] - epsilon as [Upper Range]

FROM ...table B...

Left Join (A)

LOAD [Lower Range],

  [UpperRange] - epsilon as [Upper Range],

  Class

FROM ...table B...


Replace the ellipses with the correct FROM clauses for your requirements. The value epsilon is a small amount to make sure that a value like 10 does not get assigned two class values.

You can drop the field [Lower Range] and [Upper Range] if you have no further need for them.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Community Browser