Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
New Contributor II

Combining two variables

Hi, 

 

I have used a Left join below to try and combine the spend ratings into categories. Fro example I have tried to combine the Total spend of spend rating 10 and 9 into category 5. But Category 5 still displays the separate spend ratings Total spend. 

clipboard_image_0.png

clipboard_image_2.png

How do I get Category 5 to be the sum of BOTH 10 and 9 spend ratings Total spend?

 

Regards, 

Oscar 

Labels (2)
1 Solution

Accepted Solutions
Highlighted
Partner
Partner

Re: Combining two variables

Try using this in the script editor

Load       Rating,
                 if(Match(Rating,'1','2'), 'C1',
                     if(Match(Rating,'3','4'),'C2',
                          if(Match(Rating,'5','6'),'C3',
                               if(Match(Rating,'7','8'),'C4',
                                    if(Match(Rating,'9','10'),'C5'))))) as RatingCategory
Resident Rating;

 

Hope it helps 

Thanks,

View solution in original post

2 Replies
Highlighted
Partner
Partner

Re: Combining two variables

Try using this in the script editor

Load       Rating,
                 if(Match(Rating,'1','2'), 'C1',
                     if(Match(Rating,'3','4'),'C2',
                          if(Match(Rating,'5','6'),'C3',
                               if(Match(Rating,'7','8'),'C4',
                                    if(Match(Rating,'9','10'),'C5'))))) as RatingCategory
Resident Rating;

 

Hope it helps 

Thanks,

View solution in original post

Highlighted
New Contributor II

Re: Combining two variables

Perfect, exactly what I was trying!