Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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
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
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"
I believe your request has been answered, don't forget to close the topic by marking the accepted solution
thanks
Att, Matheus