Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count duration ranges out of start/end date

I am quite new with Qlik and checked out a couple of things and the forum for further help, but was not able to get further.

I got a table with a couple of entries including a start and end date per entry in the format DD/MM/YY. So I changed the data editor to

SET DateFormat='DD/MM/YY';

but now I am stuck. I need to count the entries in groups of <6 month (or ~180 days), >6 month and 1 year (or ~360 days) and the rest. This should be printed in a pie-chart.

After trying a couple of soultions I even don't manage to print down the results in a table and I am not sure whether a correct day duration is being calculated

3 Replies
sunny_talwar

Would you be able to provide a sample with the expected output?

Not applicable
Author

Hi Sunny,

my table includes "Start Date" and "End Date". The "Duration" is just listed as an example. The Output should list the number of

Start DateEnd DateDuration
01.10.201630.09.20201460
01.10.201631.03.2017181
01.08.201430.09.20171156
08.08.201617.10.201670
01.09.201630.09.20201490
01.10.201630.09.20201460
01.10.201630.09.20201460
01.10.201630.09.20201460
01.10.201631.03.2017181
01.10.201630.09.20201460

  • < 6 month (<180d): 1
  • > 6 month (>180d): 2
  • > 12 month (>360d): 7

-> into a pie chart

I hope this information helps

Later on I need to include a monthly forecast. But first of all i need to manage step first

sunny_talwar

May be like this where you create the ranges in the script:

Table:

LOAD *,

  If(Duration < 180, Dual('<180d', 1),

  If(Duration < 360, Dual('>180d', 2), Dual('>360d', 3))) as Range;

LOAD [Start Date],

    [End Date],

    [End Date] - [Start Date] as Duration

FROM

[https://community.qlik.com/thread/236251]

(html, codepage is 1252, embedded labels, table is @1);

Capture.PNG