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: 
Not applicable

Customize Class Function

Hi Guys

Two things:

1.

Im currently using the class function and i get the result below:

BandSum
0 - 31 100
3 - 625 600
6 - 9500
9 - 12946
12 - 156 324
15 - 181 659
18 - 21100

However my desired result would be the following:

BandSum
0 - 31 100
3 - 625 600
6 - 9500
9 - 12946
12 +8 083

Is there a way to do this? Where you could set a max on the class like my example above of 12+, instead of 12 - 15, 15 -18 etc.

Second thing:

2.  Is there a way to customize the Class?

For example:

0 - 3,

4 - 6,

7 - 9,

10 - 14,

15 - 19 etc ...

4 Replies
rubenmarin

Hi Magen, for the first thing you can check first the '+12' and then use class, ie:

If(Band>12, '+12', class(...))

For the second, if you don't have a fixed step beteween values you should apply each condition using concatenated 'If':

If(Band<4, '0-3', //Better using Dual('0-3', 0) instead of the string '0-3', helps sorting values

If(Band<7, '4-6',

In your example you don't have fixed steps:

0 - 3, //4 values

4 - 6, // 3 values

7 - 9, // 3 values

10 - 14, // 5 values

nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

Check this Sample app .it might help you.

krishna20
Specialist II
Specialist II

Hi,

Try this in your script below the SUM Field.

if(SUM >=0 and SUM <=3,Dual('0-3,0',1),

if(SUM >=4 and SUM <=6,Dual('4-6',2),

if(SUM >=7 and SUM <=9,Dual('7-9',3),

if(SUM >=10 and SUM <=14,Dual('10-14',4),

if(SUM >=15 and SUM <=19,Dual('15-19',5),

if(SUM >20,Dual('Above 20',6))))))))) as  Band

Hope it helps.

sunilkumarqv
Specialist II
Specialist II

Try this in script or expression

Text(If(TempBrand<12,Replace(Class(TempBrand,6),' <= x < ','-'),'+12')) as Brand

or

Expression

Text(If(TempBrand<12,Replace(Class(TempBrand,6),' <= x < ','-'),'+12'))