Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

how to?

Hello I got a table on my datasource with the following structure and sample data

USERID     Brand     Stock

12               1,2          12,5,6

13               1,3,4

...

Actually the values 1,2 under the brand column refer to two brand keys

so I want to get this table to QlikView as follows:

UserBrand:

USERID     Brand

12          1

12          2

13          1

13          3

13          4

UserStock:

UserID          Stock

12               12

12               5

12               6

may you please help me with the script that accomplishes this?

I can walk on water when it freezes
1 Solution

Accepted Solutions
nagaiank
Specialist III
Specialist III

Here is a script which accomplishes this:

OrigData:

LOAD * Inline [

UserID, Brand, Stock

12, '1,2', '12,5,6'

13, '1,3,4'

];

UserBrand:

LOAD UserID, SubField(Brand,',') as BrandExpanded

Resident OrigData Where Len(Brand) > 0;

UserStock:

LOAD UserID, SubField(Stock,',') as StockExpanded

Resident OrigData Where Len(Stock) > 0;

View solution in original post

3 Replies
nagaiank
Specialist III
Specialist III

Here is a script which accomplishes this:

OrigData:

LOAD * Inline [

UserID, Brand, Stock

12, '1,2', '12,5,6'

13, '1,3,4'

];

UserBrand:

LOAD UserID, SubField(Brand,',') as BrandExpanded

Resident OrigData Where Len(Brand) > 0;

UserStock:

LOAD UserID, SubField(Stock,',') as StockExpanded

Resident OrigData Where Len(Stock) > 0;

its_anandrjs
Champion III
Champion III

Hi,

Load data some thing like

UserBrand:

Load * inline

[

USERID,     Brand

12,          1

12,          2

13,          1

13,          3

13,          4

];

UserStock:

Load * inline

[

UserID,          Stock

12,               12

12,               5

12,               6

];

What is your actual requirements please clear it.

Regards

Anand

Sokkorn
Master
Master

Hi Ali,

Please check in the attached file.

Do let me know if this one help you.

Regards,

Sokkorn