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

hierarchy unique ID

I have a problem with my data in the hierarchy I created.
I have a unique productgroupID, but for one productID there are sometimes more than one description.
So some productgroups are double in my hiearchy.

How can I select only the first description ?

2 Replies
Not applicable
Author

Hello,

you can use the EXISTS function:

LOAD
prodKey,
prodName
FROM MyExcelFile.xls
WHERE NOT EXISTS (prodKey);

This loads only the first occurence of prodKey, whatever prodName will follow.

Not applicable
Author





it doesn't work with not exists. this is my code:

Artikeltree:

HIERARCHY

( %Key_Product_groep, artparent, artikelgroepoms, , artikelgroepoms , Path)

LOAD

artgrp

,

//as %Key_Product_groep, //(artgrp of artgrp-fl)

left(artgrp,(4*(niv-1))) & repeat( '0000', 8-niv+1) as artparent,

// laatste 4 posities eeraf voor parent te verkrijgen

// toevoegen van x '0000' om aan 8 occurencies te geraken

//omschr1 as artikelgroepoms,

num

(left(artgrp,4)) & '.' & if((num(mid(artgrp,5,4)))<>0,num(mid(artgrp,5,4)))& '.' & if((num(mid(artgrp,9,4)))<>0,num(mid(artgrp,9,4)))& '.' & if((num(mid(artgrp,13,4)))<>0,num(mid(artgrp,13,4))) & '.' & if((num(mid(artgrp,17,4)))<>0,num(mid(artgrp,17,4)))& '.' & if((num(mid(artgrp,21,4)))<>0,num(mid(artgrp,21,4)))& '.' & if((num(mid(artgrp,25,4)))<>0,num(mid(artgrp,25,4)))& '.' & if((num(mid(artgrp,29,4)))<>0,num(mid(artgrp,29,4))) & '.' & omschr1 as artikelgroepoms

,

if

(left(artgrp,4) <>9, artgrp) as %Key_Product_groep2

// alle artikelgroepen vn groep 9 niet opladen

FROM













..

\data\QVD\artgrp.qvd







(

qvd

)

WHERE

NOT EXISTS (artgrp)

;