Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How can i related the single row values to multiple row values?

My source is from an xml file which i then added into excel to look like this because it seem more better for me.

I  found part of the answer from this post Converting rows into multiple columns | Qlik Community which worked for me.

How can i related the single row values to multiple row values?

IDNAMEGROUPS
123William1
123William23423
12314RAJ1
12314RAJ312
12314RAJ34
12314RAJ3242
23232John32
23232John43223
23232John122344
23232John1321

Load RowNo() as link, A as [ID]

FROM [SAMPLE>XLSX](ooxml, no labels, table is Sheet2)

where B = 'ID';


Left Join LOAD RowNo() as link, A as [NAME]

FROM [SAMPLE>XLSX](ooxml, no labels, table is Sheet2)

where B = 'NAME';

I was able to join the ids and names using above method but since there are multiple groups, this technique is not working for groups. Can you suggest something?

2 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

HI,

Try this script.

Data:

LOAD A,

     B,

     C,

     D,

     RowNo() as SR

FROM

[SAMPLE (1).xlsx]

(ooxml, no labels, table is Sheet1);


Final:

Load A as ID, SR as SR1

Resident Data where B='ID';


Left join(Final)

Load SR-1 as SR1,A as Name

Resident Data where B='NAME';


Left join(Final)

LOad C as Group,SR-D-2 as SR1

Resident Data where B = 'Groups' and D<>'Total';


Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
tamilarasu
Champion
Champion

Hello Vaibhav,

Data:

LOAD

If(Isnull(A), Peek(A), A) as A,

If(Peek(B) Like '*ID', Peek(A), Peek('ID')) as ID,

     B,

     C,

     D

FROM

[..\Downloads\SAMPLE (8).xlsx]

(ooxml, no labels, table is Sheet1);

Result:

Load RowNo() as RowID,

ID,

A as NAME,

C as GROUPS

Resident Data

Where Not WildMatch(B,'*ID','NAME') and D <> 'Total';

DROP Table Data;

Result:

Capture.PNG