Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Bobi
Partner
Partner

Count the number, within specific time-interval.

Hi. I want to calculate number of cases that has been taking between 6 months-12 months. I also want to calculate number of cases which took less than 6 months. 

I calculated the time for the different cases by this formula: (Interval([c_enddate]-[c_startdate],'d')) as result,

c_enddate is when the project is done, and c_startdate when it starts. 


End result sholud be something like:

       Groups:                           0-6 months:           6-12 months:          >12 months

      Nr of cases:                                 500                       600                               400

5 Replies
Bobi
Partner
Partner
Author

Any suggestions? I have tried with intervalmatch, set analysis and a whileloop but without succeding yet.

help would be greatly appreciated.

vikasmahajan
Champion
Champion

Hi ,

While loading data you need to create a buckets like this post

https://community.qlik.com/t5/New-to-Qlik-Sense/Creating-buckets/m-p/1353493

 

Vikas

 

kashyap
Partner
Partner

Hi 

Try using if, IntervalMatch  or class  Functions

Thanks

Bobi
Partner
Partner
Author

Hi. Thanks. I already tried that so would be Great if someone could provide an example-script with my field-names?

kashyap
Partner
Partner

Hi 

Try this 

 

Let vDiff = ((year([c_enddate])*12)+month([c_enddate])) - (((year([c_startdate])*12)+month([c_startdate])));


IF($(vDiff)>=0 and $(vDiff)<=6 ,'0 - 6 Months',
IF($(vDiff)>=7 and $(vDiff)<=12 ,'7 - 12 Months','>12 Months')) as Difference Bucket

 

Hope this helps 

Thanks