Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have created agebucket like this
if(Age>=0 and Age<=25, Dual('<25 Yr',1),
if(Age>25 and Age<=30, Dual('25-30 Yr',2),
if(Age>30 and Age<=35, Dual('30-35 Yr',3),
if(Age>35 and Age<=40, Dual('35-40 Yr',4),
if(Age>40, Dual('>40 Yr',5),dual('NA',15)))))) as [Age Bucket],
Now I want avoid multliple If conditions
My script looks like as below but its not working.
If(Pick(Match(Age,Age>=0 and Age<=25,Age>25 and Age<=30,Age>30 and Age<=35,Age>35 and Age<=40,Age>40),
Dual('<25 Yr',1),Dual('25-30 Yr',2),Dual('30-35 Yr',3),Dual('35-40 Yr',4),Dual('>40 Yr',5)),dual('NA',15))
Please suggest where I did wrong.
May be try this
if(AGE<=25,Dual('<25 Yr',1),if(AGE<=30,Dual('25-30 Yr',2),if(AGE<=35,
Dual('30-35 Yr',3),if(AGE<=35,Dual('35-40 Yr',4),if(AGE<=40,Dual('40-45 Yr',4),Dual('NA',5)))))) as bucket
,If(Not IsNum(Age),Dual('NA',1000),
If(Age <= 25, Dual('<25 Yr',1),
If(Age > 40, Dual('>40 Yr', 100),
Dual(Replace(Class(Age-1,5),'<= x <','-')& ' yr',Class(Age-1,5))
))) as AgeBucket