Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I want to order by Age Group :
My script:
LOAD
[Age],
if(Age<=50 ,'Age Below 50',
if(Age>=50 and Age<=59 ,'Between 50-59',
if(Age>=60 and Age<=69 ,'Between 60-69',
if(Age>=70 and Age<=79 ,'Between 70-79',
if(Age>=80 and Age<=89 ,'Between 80-89',
if(Age>90 ,'Above 90','Other'
)))))) as [Age Group]
ResidentPATIENT;
Hi @ashmitp869
Try like Dual() function & sort by numeric
LOAD
[Age],
if(Age<=50 , Dual('Age Below 50',1),
if(Age>=50 and Age<=59 ,Dual('Between 50-59',2),
if(Age>=60 and Age<=69 , Dual('Between 60-69',3),
if(Age>=70 and Age<=79 ,Dual('Between 70-79',4),
if(Age>=80 and Age<=89 ,Dual('Between 80-89',5),
if(Age>90 ,Dual('Above 90',6), Dual('Other',7)
)))))) as [Age Group]
ResidentPATIENT;
Hi @ashmitp869
Try like Dual() function & sort by numeric
LOAD
[Age],
if(Age<=50 , Dual('Age Below 50',1),
if(Age>=50 and Age<=59 ,Dual('Between 50-59',2),
if(Age>=60 and Age<=69 , Dual('Between 60-69',3),
if(Age>=70 and Age<=79 ,Dual('Between 70-79',4),
if(Age>=80 and Age<=89 ,Dual('Between 80-89',5),
if(Age>90 ,Dual('Above 90',6), Dual('Other',7)
)))))) as [Age Group]
ResidentPATIENT;
You could also create a simple inline table also and achieve
Load * Inline
[
Age Group,Age_Group_Sort
'Age Below 50',1
'Between 50-59',2
'Between 60-69',3
'Between 70-79',4
'Between 80-89',5
'Above 90',6
'Other',7
];
Use Age_Group_Sort in the sorting