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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Grouping of Column values

I have a column called States.

STATES

AL

GA

MI

SFO,SAN,WD,MI

MD;SAN

FL


Note:I have , and ; and space within the values.SFO,SAN,WD,MI has ',' in between where as MD;SAN has ';' in between and also

before GA there is a space.


How can I group this column values as below.SFO and SAN should fall under CAL.So,here new row called CAL gets created for SFO and SAN.


STATES

AL

GA

MI

WD

MD

FL

CAL

6 Replies
lironbaram
Partner - Master III
Partner - Master III

hi

per your example

you can use this script

/////////////replacing value for sfo and san////////////////

load if(match(STATES,'SFO','SAN')>0,'CAL',STATES) AS STATES;

/////////////creating one value from raw data/////////////

load subfield(replace(trim(STATES),';',','),',') AS STATES;

LOAD * INLINE [

    STATES

    AL

    GA

    MI

    "SFO,SAN,WD,MI"

    MD;SAN

    FL

];

Not applicable
Author

Thank you.Here I am losing all  other dimensions once I reload the script.STATES is displaying exactly how I want.

load if(match(STATES,'SFO','SAN')>0,'CAL',STATES)  AS STATES;

load subfield(replace(trim(STATES),';',','),',') AS STATES;

Can I combine these 2 script something like below ?


load if(match(STATES,'SFO','SAN')>0,'CAL',STATES)   and subfield(replace(trim(STATES),';',','),',') AS STATES;

sasiparupudi1
Master III
Master III

try

map11:

Mapping load * Inline

[

from ,to

SFO,CAL

SAN,CAL

];

aaaa:

load  Distinct subfield(MapSubString('map11',replace(trim(STATES),';',',')),',') AS STATES;

LOAD * INLINE [

    STATES

    AL

    GA

    MI

    "SFO,SAN,WD,MI"

    MD;SAN

    FL

];

Not applicable
Author

Same thing here too.This is removing all other dimensions.Only I see is STATES dimension.

sasiparupudi1
Master III
Master III

Can you pl post a sample

Not applicable
Author

Hi

I couldnt upload the file here,so I created another thread Called grouping filed values.Can you please look into it ?

Thank you very much.