Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am wondering what is wrong with my expression. The IF statement works with just the first part, but if I add in the second parameters, I get the error "Error in expression: If takes 2-3 parameters". Can anyone help me to correct the syntax so that I have the specified 3 buckets?
=
IF
(
(Round( ((TODAY())-DOB)/365) ) >=6
and
(Round( ((Today())-DOB)/365) ) <=17
)
,'6-17',
IF
(
(Round( ((TODAY())-DOB)/365) ) >17
and
(Round( ((Today())-DOB)/365) ) <=65
)
,'18-65','OTHER'
Hi Isabel. Maybe this
= IF(
(Round( ((TODAY())-DOB)/365) ) >=6
and
(Round( ((Today())-DOB)/365) ) <=17
,'6-17',
IF(
(Round( ((TODAY())-DOB)/365) ) >17
and
(Round( ((Today())-DOB)/365) ) <=65
,'18-65', 'OTHER'))
Hi Isabel. Maybe this
= IF(
(Round( ((TODAY())-DOB)/365) ) >=6
and
(Round( ((Today())-DOB)/365) ) <=17
,'6-17',
IF(
(Round( ((TODAY())-DOB)/365) ) >17
and
(Round( ((Today())-DOB)/365) ) <=65
,'18-65', 'OTHER'))
Yes, that's it, Perfect, Thanks!
There were a few misplaced parentheses. The below should work.
=IF(Round(((TODAY())-DOB)/365)
>=6 and Round(((Today())-DOB)/365) <=17 ,'6-17',
IF(Round(((TODAY())-DOB)/365) >17 and Round((Today()-DOB)/365) <=65 ,'18-65','OTHER'))
Also, qlikview has a function for everything:
=IF(Age(TODAY(),DOB) >=6 and Age(TODAY(),DOB) <=17 ,'6-17',IF(Age(TODAY(),DOB) >17 and Age(TODAY(),DOB) <=65 ,'18-65','OTHER'))
To take it one step further you can do an interval match in the load to calculate the buckets. If you'd like an example of that just reply and let me know.