Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Bobi
Partner - Contributor II
Partner - Contributor II

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 - Contributor II
Partner - Contributor II
Author

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

help would be greatly appreciated.

vikasmahajan

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

 

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Kashyap_R
Partner - Specialist
Partner - Specialist

Hi 

Try using if, IntervalMatch  or class  Functions

Thanks

Thanks and Regards
Kashyap.R
Bobi
Partner - Contributor II
Partner - Contributor II
Author

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

Kashyap_R
Partner - Specialist
Partner - Specialist

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

Thanks and Regards
Kashyap.R