Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
uacg0009
Partner - Specialist
Partner - Specialist

How to merge categories in dimension and pick it,not in script?(hurry)

Hi all,

I have data like :

Merge Category.png

Now I want to merge the CATE to new category.

the new cate would be:

PPP=A,B,C

SSS=AA,BB,CC

DDD=AAA,BBB,CCC

Names(PPP,DDD,SSS) are not important I thiink, because I want to calculate,

how many vips buy only one new cate, how many vips buy more than one new cate.

The result should be:

Merge Category1.png

I hope I have clarified what I want, and if you have any further question please feel free to contact me.

Thank you so much.

8 Replies
alexandros17
Partner - Champion III
Partner - Champion III

when you load your data do something like:

load

...

If(cate='A' or cate='B' or cate='C', 'PPP',

If(cate='AA' or cate='BB' or cate='CC', 'SSS',

If(cate='AAA' or cate='BBB' or cate='CCC', 'DDD',

'---'

)

)

) as myField

and use this new field as dimension

sushil353
Master II
Master II

Hi,

You can create new CATE using below expression:

load

...

if(len(CATE)=1,'PPP',if(len(CATE)=2,'SSS','DDD')) as NewCATE,

...

...


HTH

Sushil

uacg0009
Partner - Specialist
Partner - Specialist
Author

Hi Alessandro,

Thanks for your reply, but i want to finish it in dimension, not in script, do you have any idea to solve it?

uacg0009
Partner - Specialist
Partner - Specialist
Author

Hi Sushil,

Could you have any idea to solve this in dimension, not in script?

Thank you for your reply.

alexandros17
Partner - Champion III
Partner - Champion III

use this

If(cate='A' or cate='B' or cate='C', 'PPP',

If(cate='AA' or cate='BB' or cate='CC', 'SSS',

If(cate='AAA' or cate='BBB' or cate='CCC', 'DDD',

'---'

)

)

)

as dimension, it works

uacg0009
Partner - Specialist
Partner - Specialist
Author

I want to calculate,how many vips buy only one new cate, how many vips buy more than one new cate.


Not just output PPP SSS DDD, do you have any idea?

Colin-Albert

You can use the expressions given by Alessandro in a calculated dimension, but it is much more efficient to do calculations like this in the script.

uacg0009
Partner - Specialist
Partner - Specialist
Author

I want to calculate,how many vips buy only one new cate, how many vips buy more than one new cate.


Not just output PPP SSS DDD, Could you please clarify how to do that using Alessandro's expressions?