Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
durgabhavani
Creator III
Creator III

Help me to map values without duplicates.

Hi All,

Please help me to map values to my field category with out duplicates in row. Please find expected output below. Already I have tried mapsubstring function but not able to remove duplicates field values in row.

 

Category
01,01
02,04
05,08
09,07,03
02,04,02,03
05,05,06,06
04,03,06
03,04,05,06
01,02,03,04

Mapping File data:   

Category_LevelCategory_Name
01Charity
02Global
03Cash
04Other
05Gaming
06Business
07Government
08Hospital
09Gold

Expected Output.

   

Category
Charity
Global,Other
Gaming,Hospital
Gold,Government,Cash
Global,Other,Cash
Gaming,Business
Other,Cash,Business
Cash,Other,Gaming,Business
Charity,Global,Cash,Other

Please advice.

Thanks,

Durga

1 Solution

Accepted Solutions
sunny_talwar

Try this

MappingTable:

Mapping

LOAD * INLINE [

    Category_Level, Category_Name

    01, Charity

    02, Global

    03, Cash

    04, Other

    05, Gaming

    06, Business

    07, Government

    08, Hospital

    09, Gold

];


FactTable:

LOAD Key,

MapSubString('MappingTable', Concat(DISTINCT Category, ', ')) as Category

Group By Key;

LOAD Category as Key,

SubField(Category, ',') as Category;

LOAD * INLINE [

    Category

    "01,01"

    "02,04"

    "05,08"

    "09,07,03"

    "02,04,02,03"

    "05,05,06,06"

    "04,03,06"

    "03,04,05,06"

    "01,02,03,04"

];

View solution in original post

2 Replies
sunny_talwar

Try this

MappingTable:

Mapping

LOAD * INLINE [

    Category_Level, Category_Name

    01, Charity

    02, Global

    03, Cash

    04, Other

    05, Gaming

    06, Business

    07, Government

    08, Hospital

    09, Gold

];


FactTable:

LOAD Key,

MapSubString('MappingTable', Concat(DISTINCT Category, ', ')) as Category

Group By Key;

LOAD Category as Key,

SubField(Category, ',') as Category;

LOAD * INLINE [

    Category

    "01,01"

    "02,04"

    "05,08"

    "09,07,03"

    "02,04,02,03"

    "05,05,06,06"

    "04,03,06"

    "03,04,05,06"

    "01,02,03,04"

];

durgabhavani
Creator III
Creator III
Author

Thank you sunny... Its working....