Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
stormseekerx1
Contributor II
Contributor II

How do i create all possible combination (order does not matter) according to category?

How do i create all possible combination (order does not matter) according to category?

 

sample data:

transport grab
transport uber
transport comfort
bank dbs
bank hsbc
bank ocbc
bank uob
food kfc
food macdonald
food burger_king
food five_fingers
food long_john_silver

 

 

desired output:

Category combination
transport grab, uber
transport grab, comfort
transport uber, comfort
bank dbs, hsbc
bank dbs, ocbc
bank dbs, uob
bank hsbc, ocb
bank hsbc, uob
bank ocbc, uob
food kfc, macdonald
food kfc, burger_king
food kfc, five_fingers
food kfc, long_john_silver
food macdonald, burger_king
food macdonald, five_fingers
food macdonald, long_john_silver
food burger_king, five_fingers
food burger_king, long_john_silver
food five_fingers, long_john_silver

 

 

 

Labels (1)
1 Solution

Accepted Solutions
LRuCelver
Partner - Creator III
Partner - Creator III

Here you go:

Data:
NoConcatenate Load 
	*, 
	AutoNumber(Item) as ItemId 
Inline [
    Category, 	Item
    transport,	grab
    transport,	uber
    transport,	comfort
    bank,		dbs
    bank,		hsbc
    bank,		ocbc
    bank,		uob
    food,		kfc
    food,		macdonald
    food,		burger_king
    food,		five_fingers
    food,		long_john_silver
];

Join Load Distinct
	Category,
	ItemId as ItemId2,
	Item as Item2
Resident Data;

Combinations:
NoConcatenate Load
	Category,
	Item & ', ' & Item2
Resident Data
Where ItemId < ItemId2;

Drop Table Data;

View solution in original post

2 Replies
LRuCelver
Partner - Creator III
Partner - Creator III

Here you go:

Data:
NoConcatenate Load 
	*, 
	AutoNumber(Item) as ItemId 
Inline [
    Category, 	Item
    transport,	grab
    transport,	uber
    transport,	comfort
    bank,		dbs
    bank,		hsbc
    bank,		ocbc
    bank,		uob
    food,		kfc
    food,		macdonald
    food,		burger_king
    food,		five_fingers
    food,		long_john_silver
];

Join Load Distinct
	Category,
	ItemId as ItemId2,
	Item as Item2
Resident Data;

Combinations:
NoConcatenate Load
	Category,
	Item & ', ' & Item2
Resident Data
Where ItemId < ItemId2;

Drop Table Data;
stormseekerx1
Contributor II
Contributor II
Author

Thanks! your a genius.