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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
wonkymeister
Creator III
Creator III

Create a Sub Group

Morning,

I need to create my own sub group within my dataset.

I have a field called customer_code – I want to create a sub group to group them into depending on the customer type.

i.e.

customer_code 100200 = sub_group banking

customer_code 101230 = sub_group banking

customer_code 600300 = sub_group hotel

customer_code 600500 = sub_group hotel

customer_code 123456 = sub_group food & beverage

customer_code 321654 = sub_group food & beverage

this way I can report on the total number of customers by group (banking would contain 2 customers etc)

I thought of using apply map but cant get that to work.

Any ideas?

1 Solution

Accepted Solutions
juleshartley
Specialist
Specialist

Create an inline table (or load from an external source) as a mapping load:

Map_bankgroup:

Mapping load * inline [

CC, Grp

1000200, Banking

101230, Banking

etc...

];

Then in load of main table use

Applymap('Map_bankgroup', customer_code) as Sub_Group,

View solution in original post

4 Replies
sunny_talwar

What in customer_code column help you determine which sub-group they belong to?

juleshartley
Specialist
Specialist

Create an inline table (or load from an external source) as a mapping load:

Map_bankgroup:

Mapping load * inline [

CC, Grp

1000200, Banking

101230, Banking

etc...

];

Then in load of main table use

Applymap('Map_bankgroup', customer_code) as Sub_Group,

swuehl
MVP
MVP

MAP:

MAPPING LOAD * INLINE [

F1,F2

100200 ,banking

101230, banking

600300 , hotel

600500 ,hotel

123456 , food & beverage

321654 ,food & beverage

];

Table:

LOAD

     Applymap('MAP', customer_code,'no map') as sub_group,

     customer_code,

     ...

wonkymeister
Creator III
Creator III
Author

Thanks everyone - issue resolved!