Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
bramvdpoel
Contributor III
Contributor III

Load X if exists A else load B

Hi,

Table A:

Artid, ArtLev, Vlgnr

658ABC1
658BCA2
658DGE3
659ABB2
659BBE3
670FHG1

 

In table A 'Artid' has multiple values sorted by 'Vlgnr'. But sometimes Vlngr 1 of 2 doesn't exist but 3,4,5 etc do.

I want to load ArtLev where Vlgnr = 1, if 1 doesn't exists i want to load 2.

Can anyone help?

1 Solution

Accepted Solutions
sunny_talwar

May be just this

Table:
LOAD * INLINE [
    Artid, ArtLev, Vlgnr
    658, ABC, 1
    658, BCA, 2
    658, DGE, 3
    659, ABB, 2
    659, BBE, 3
    670, FHG, 1
];

Right Join (Table)
LOAD Artid,
     Min(Vlgnr) as Vlgnr
Resident Table
Group By Artid;

View solution in original post

1 Reply
sunny_talwar

May be just this

Table:
LOAD * INLINE [
    Artid, ArtLev, Vlgnr
    658, ABC, 1
    658, BCA, 2
    658, DGE, 3
    659, ABB, 2
    659, BBE, 3
    670, FHG, 1
];

Right Join (Table)
LOAD Artid,
     Min(Vlgnr) as Vlgnr
Resident Table
Group By Artid;