Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
Earlier this code developed in Alteryx. Tool. I want convert to this code into qlikview. if it is possible pls let me know.
IF [Date of Birth]> "1940-12-31 00:00:00" AND [Date of Birth]< "1966-01-01 00:00:00" THEN "BabyB"
ELSEIF [Date of Birth]> "1965-12-31 00:00:00" AND [Date of Birth]< "1986-01-01 00:00:00" THEN "Gen X"
ELSE "Gen Y"
ENDIF
IF [Tenure in Yr]<=1 THEN "0-1" ELSEIF
[Tenure in Yr]>1 and [Tenure in Yr]<=3 THEN "1-3" ELSEIF
[Tenure in Yr]>3 and [Tenure in Yr]<=5 THEN "3-5" ELSEIF
[Tenure in Yr]>5 and [Tenure in Yr]<=10 THEN "5-10"
ELSE "> 10 years" ENDIF
Thanks,
Krishna
IF( [Tenure in Yr]<=1 , "0-1" ,if(
[Tenure in Yr]>1 and [Tenure in Yr]<=3 , "1-3",IF(
[Tenure in Yr]>3 and [Tenure in Yr]<=5 , "3-5",IF(
[Tenure in Yr]>5 and [Tenure in Yr]<=10 , "5-10", 10 years")))) as new
IF NOT Remove double quotes on numbers
Hi,
Try,
IF( [Tenure in Yr]<=1 , '0-1' ,if(
[Tenure in Yr]>1 and [Tenure in Yr]<=3 , '1-3',IF(
[Tenure in Yr]>3 and [Tenure in Yr]<=5 , '3-5',IF(
[Tenure in Yr]>5 and [Tenure in Yr]<=10 , '5-10', '10 years')))) as FieldName
IF ([Date of Birth]> '1940-12-31 00:00:00' AND [Date of Birth]< '1966-01-01 00:00:00', 'BabyB',
IF( [Date of Birth]> '1965-12-31 00:00:00' AND [Date of Birth]< '1986-01-01 00:00:00', 'Gen X', 'Gen Y')) as Fieldname
Hi Chanty,
Thanks for quick reply.
pls tell me for this code:
IF [Date of Birth]> "1940-12-31 00:00:00" AND [Date of Birth]< "1966-01-01 00:00:00" THEN "BabyB"
ELSEIF [Date of Birth]> "1965-12-31 00:00:00" AND [Date of Birth]< "1986-01-01 00:00:00" THEN "Gen X"
ELSE "Gen Y"
ENDIF
try this
If([Date of Birth]> '1940-12-31 00:00:00' AND [Date of Birth]< '1966-01-01 00:00:00', 'BabyB',
If( [Date of Birth]> '1965-12-31 00:00:00' AND [Date of Birth]< '1986-01-01 00:00:00', 'Gen x', 'Gen y')) as urfield
Use Dual function to create the buckets so that you can sort the bucket
IF([Tenure in Yr]<=1 ,dual('0-1',1),
if( [Tenure in Yr]>1 and [Tenure in Yr]<=3 ,dual('1-3',2),
if( [Tenure in Yr]>3 and [Tenure in Yr]<=5 ,dual('3-5',3),
if( [Tenure in Yr]>5 and [Tenure in Yr]<=10 ,dual('5-10',4),dual('> 10 years',5))))) as Bucket
Considering that [Date of Birth] format is YYYY-MM-DD hh:mm:ss use timestamp# function to compare the string value with Date
IF ([Date of Birth]> timestamp#('1940-12-31 00:00:00' ,'YYYY-MM-DD hh:mm:ss') AND [Date of Birth]< timestamp#('1966-01-01 00:00:00' ,'YYYY-MM-DD hh:mm:ss'), 'BabyB',
IF( [Date of Birth]> imestamp#('1965-12-31 00:00:00' ,'YYYY-MM-DD hh:mm:ss') AND [Date of Birth]< ' imestamp#('1986-01-01 00:00:00' ,'YYYY-MM-DD hh:mm:ss'), 'Gen X', 'Gen Y')) as Field