Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
soniasweety
Valued Contributor III

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?

Tags (2)
1 Solution

Accepted Solutions
qv_testing
Valued Contributor II

Re: group creation

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

Re: group creation

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

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
venkatasreekant
Valued Contributor

Re: group creation

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
Valued Contributor

Re: group creation

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
Valued Contributor II

Re: group creation

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

soniasweety
Valued Contributor III

Re: group creation

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;