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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Iterno and Gannt Chart Question

Hello all,

I need to have a "Gannt Chart" for a QV file.

I have data as

IDDateArrDep
10101.04.2012City1City2
10101.04.2012City2City1
10102.04.2012City1City3
10104.04.2012City3City1
10107.04.2012City1City4
10109.04.2012City4City1
10113.04.2012City1City5
10113.04.2012City5City1


City 1 is where the company operates, base city..I need to make a table like below.

April
12345678910111213
101City2City3City3City3City4City4City4City5


For example for the 1st of April, the person goes to City2 and comes back to City1 on the same day,so I should make 1st of April green on Gannt Chart,but like at 2nd of April, he goes to City3 and comes back at 4th of April, and I should make the Gannt chart green for 2nd,3rd, and 4th of April. I know that I should make the load statement with "Iterno()", but how do I say "Check the Departure, if it is City 1 then take it"

thanks in advance

Seyma

Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

Seyma,

I think you can do it like this:

INPUT:

LOAD recno() as Line,

     if(Arr<>'City1', peek(Date)) as TripStart,

     if(Arr<>'City1',Date) as TripEnd,

     if(Arr<>'City1', Arr) as  TripTarget,

     ID,

     Date,

     Arr,

     Dep

FROM

[http://community.qlik.com/thread/54680?tstart=0]

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

RESULT:

LOAD autonumber(Line) as TripNo, ID, TripTarget, Date(TripStart+iterno()-1) as TripDate

Resident INPUT while TripStart+iterno()-1 <= TripEnd;

drop table INPUT;

In the INPUT table, I created new fields TripStart, TripEnd and TripTarget from your data for the 'returning' record lines (Arr<>'City1'). Then I used a while loop in a second load to create all trip dates with appropriate data (here I used your requested iterno() ).

The results table should already give you the requested information. If you want, you can link the TripDate to a master calendar, so you can create a calendar style object also with days without trips. Search the forum for master calendar if you want to.

Regards,

Stefan

View solution in original post

2 Replies
swuehl
Champion III
Champion III

Seyma,

I think you can do it like this:

INPUT:

LOAD recno() as Line,

     if(Arr<>'City1', peek(Date)) as TripStart,

     if(Arr<>'City1',Date) as TripEnd,

     if(Arr<>'City1', Arr) as  TripTarget,

     ID,

     Date,

     Arr,

     Dep

FROM

[http://community.qlik.com/thread/54680?tstart=0]

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

RESULT:

LOAD autonumber(Line) as TripNo, ID, TripTarget, Date(TripStart+iterno()-1) as TripDate

Resident INPUT while TripStart+iterno()-1 <= TripEnd;

drop table INPUT;

In the INPUT table, I created new fields TripStart, TripEnd and TripTarget from your data for the 'returning' record lines (Arr<>'City1'). Then I used a while loop in a second load to create all trip dates with appropriate data (here I used your requested iterno() ).

The results table should already give you the requested information. If you want, you can link the TripDate to a master calendar, so you can create a calendar style object also with days without trips. Search the forum for master calendar if you want to.

Regards,

Stefan

Not applicable
Author

Thank you Swuehl, it works