Do not use this expression in Case.
First Calculate LTMonth. like.........
(LTDays/365*12) as Lt Months;
Drop table SynergyCases;
if ((LTMonths) >=0 and (LTMonths) <=1, '0-1',
if((LTMonths) >=1 and (LTMonths) <=2, '1-2 yrs',
if((LTMonths) >=2 and (LTMonths) <=3, '2-3 yrs',
if((LTMonths) >=3 and (LTMonths) <=4, '3-4 yrs',
if((LTMonths) >=4 and (LTMonths) <=5, '4-5 yrs',
if((LTMonths) >=5 and (LTMonths) <=6, '5-6 yrs',
if((LTMonths) >=6 , '6 and Above Month',))))))) AS BucketMonth;
Drop table Test1;
This will ceate BucketMonth as your bucket field.
Thanks and Regards,
You name your table Test1 and then want to get the data for that table from Test1. That won't work. Give your first table where you create LtMonths a name and use that name with the resident keyword in the second load.
Or just do it with one load:
if(LTDays/365>=24,'24+',class(LTDays/365,1)) as BUCKET