Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sttran
Contributor
Contributor

How do I lump 2 items from a field together and rename the new field?

Hi everyone,

I have a field called Sales Type with 4 values Import, Domestic, Export, and Other. Besides this field, I have other fields in the load script as well. The data comes from 2 sources (A and B), which have their own section in the load script. 

Source A has all Import, Domestic, Export, and Other

Source B doesn’t have Domestic but has the other three

I would like to lump the data of Other and Domestic together and rename the new field to Other/Domestic in Source A. Source B I would like to rename Other to Other/Domestic so that both source can connect. 

Is this possible to do? Is there anything I should add to the load script of each source to make this happens?

1 Reply
MeehyeOh
Partner - Creator
Partner - Creator

Hi, @Sttran 

Like this?

 

- Load Script

SourceA:
Load 
SalesType As SalesTypeA,
ValueA,
    If(SalesType = 'Domestic' Or SalesType = 'Other', 'Other/Domestic', SalesType) As "Other/Domestic"

Inline [ 
SalesType, ValueA
Import, A
Domestic, B
Export, C
Other, D 
];

SourceB:
Load 
SalesType As SalesTypeB,
    ValueB,
    If(SalesType = 'Other', 'Other/Domestic', SalesType) As "Other/Domestic"

Inline [
SalesType, ValueB
Import, A
Export, C
Other, D
];

 

- Visualizstion

MeehyeOh_1-1717378500847.png

(Select Other/Domestic)

MeehyeOh_2-1717378530281.png