Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Thrive
Contributor II
Contributor II

Combine multiple fields into one field

I'm a total beginner to QLik sense. I'm trying to combine multiple fields into one. For example, in the screenshot below, I want to combine [ Phone_gross_adds, tablet_gross_adds, smartphone_gross_adds] into one field called "Gross Adds" and the other three fields into "Net Adds". All the gross adds products are measures, but I want the new field Gross Adds to be a dimension to create a stacked bar chart to show products by Gross Adds and Net Adds separately. Appreciate your response! Thanks. 

Thrive_0-1701976935438.png

 

Labels (6)
4 Replies
MatheusC
Specialist
Specialist

@Thrive 

Use a wlidmatch function
https://help.qlik.com/pt-BR/qlikview/May2023/Subsystems/Client/Content/QV_QlikView/Scripting/Conditi....

if(wildmatch(products,'asd','sdad'),'Gross Adds') as newField

Att,

Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
aruneshgupta
Creator
Creator

I think you can use applymap function to combine group of values 

Below is an example demonstrating how to create new field to group a set of values into a new single field.


MappingTable:
Mapping
LOAD * INLINE [
Products , Map_prod
Phone_gross_adds , Net Adds
Tablet_gross_adds, Net Adds
smartphone_g

ross_adds, Net Adds
Phone_net_adds , Gross Adds
Tablet_net_adds , Gross Adds
smartphone_net_adds , Gross Adds

];


Fact:
Load *,
applymap('MappingTable',Products) as GrpProduct
;
LOAD * INLINE [

Products, values
Phone_gross_adds,10
Tablet_gross_adds,20
smartphone_gross_adds,20
Phone_net_adds,20
Tablet_net_adds,30
smartphone_net_adds,30

];

 

----------------------------------------------------------------------------

Below is an example demonstrating how to create multiple fields to group a set of values.

 

MappingTable1:
Mapping
LOAD * INLINE [
Products , Map_prod
Phone_gross_adds, Net Adds
Tablet_gross_adds, Net Adds
smartphone_gross_adds, Net Adds

];

MappingTable2:
Mapping
LOAD * INLINE [
Products , Map_prod
Phone_net_adds, Gross Adds
Tablet_net_adds, Gross Adds
smartphone_net_adds, Gross Adds

];


Fact:Load *,
applymap('MappingTable1',Products,'') as NetAds,
applymap('MappingTable2',Products,'') as GrossAds
;
LOAD * INLINE [

Products, values
Phone_gross_adds,10
Tablet_gross_adds,20
smartphone_gross_adds,20
Phone_net_adds,20
Tablet_net_adds,30
smartphone_net_adds,30

];

 

 

Best Regards,

Arunesh 

Ahidhar
Creator III
Creator III

you could try using composite keys depending on what  values lie in those fields

phone_net_adds&'-'&tablet_net_adds&'-'&smartphone_net_adds as "Net Adds"

phone_gross_adds&'-'&tablet_gross_adds&'-'&smartphone_gross_adds as "Gross Adds"

MatheusC
Specialist
Specialist

@Thrive 

I believe your request has been answered, don't forget to close the topic by marking the accepted solution

thanks

Att, Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!