Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create chart from dates range

Hello,

I have a table with 3 fields: id, startDate and endDate

id
startDate
endDate
108/01/201308/05/2013
208/04/201308/07/2013

y-axis: number of ids between the startDate and endDate.

x-axis: days.

chart.png

This is the chart I need. I want to count the number of ids that are between the startDate and endDate.

Any ideas on how I can do this?

Thank you,

Juan.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe like this:

LOAD *,

        WeekDay(startDate+iterno()-1) as weekday,

        Date(startDate+iterno()-1) as date

INLINE [

id,    startDate,    endDate

1,    08/01/2013,    08/05/2013

2,    08/04/2013,    08/07/2013

] WHILE startDate +iterno()-1 <= endDate;

Then use weekday or num(weekday) as dimension and count(id) as expression.

View solution in original post

3 Replies
swuehl
MVP
MVP

Create the interval of your dates in the script:

Set DateFormat = 'MM/DD/YYYY';

Load id,

        startDate,

        endDate,

        endDate - startDate as interval

FROM ....;

Then create a chart with dimension inteval and count(id) as expression.

Not applicable
Author

Hi swuehl,

The dimension is not the number of days between the endDate and startdate. It should be the days in that interval, from 1 to 7. The purpose is to know how many ids are active each day of the month.

swuehl
MVP
MVP

Maybe like this:

LOAD *,

        WeekDay(startDate+iterno()-1) as weekday,

        Date(startDate+iterno()-1) as date

INLINE [

id,    startDate,    endDate

1,    08/01/2013,    08/05/2013

2,    08/04/2013,    08/07/2013

] WHILE startDate +iterno()-1 <= endDate;

Then use weekday or num(weekday) as dimension and count(id) as expression.