Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
soniasweety
Master
Master

group creation

Hi all,

I want to create a  age group   in script.

I have a date field   like OpenDate

so I want to create

0-30

31-60

61-90

91-120

120+

as   Agegroup     this as dimension I want to use in chart.

can anyone help on this?

1 Solution

Accepted Solutions
qv_testing
Specialist II
Specialist II

Try This,

If ( Date(Today()) - Date(Date_Field) ) <= 30, '0-30',

If ( Date(Today()) - Date(Date_Field) ) >= 31 and Date(Today()) - Date(Date_Field) <60, '31-60',

If ( Date(Today()) - Date(Date_Field) ) >= 61 and Date(Today()) - Date(Date_Field) <90, '61-90' ,

If ( Date(Today()) - Date(Date_Field) ) >= 91 and Date(Today()) - Date(Date_Field) <120, '91-120', '120+' )) ) ) as Days_Filter

View solution in original post

5 Replies
Anil_Babu_Samineni

Why can't you use Age() directly in your script? May be Buckets

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable

Hi Sony,


Use the Class function to create the groups.


For more help, follow below Qlik threads,


https://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/Scripting/ConditionalFun...


Class function


Thanks,

Venkata Sreekanth

jmvilaplanap
Specialist
Specialist

Hi,

Maybe you can use this function

https://help.qlik.com/es-ES/sense/September2017/Subsystems/Hub/Content/Scripting/ScriptPrefixes/Inte...

Intervalmatch, with this you can create numeric intervals and check were one line is allocated.

Regards

qv_testing
Specialist II
Specialist II

Try This,

If ( Date(Today()) - Date(Date_Field) ) <= 30, '0-30',

If ( Date(Today()) - Date(Date_Field) ) >= 31 and Date(Today()) - Date(Date_Field) <60, '31-60',

If ( Date(Today()) - Date(Date_Field) ) >= 61 and Date(Today()) - Date(Date_Field) <90, '61-90' ,

If ( Date(Today()) - Date(Date_Field) ) >= 91 and Date(Today()) - Date(Date_Field) <120, '91-120', '120+' )) ) ) as Days_Filter

soniasweety
Master
Master
Author

done this way working fine

      if(Opendate>0 and Opendate<=30,Dual('1-30',2),

                if(Opendate>30 and Opendate<=60,Dual('31-60',3),

                if(Opendate>60 and Opendate<=90,Dual('61-90',4),

                if(Opendate>90 and Opendate<=120,Dual('91-120',5),

                if(Opendate>120,Dual('> 120',6)))))) as agegroup;