Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
hic
Former Employee
Former Employee

Have you ever wanted to create a Gantt chart in QlikView, only to find out that this chart type is not one of the pre-defined charts? Then you should be happy to learn that it is possible to create a Gantt chart and that it is not very difficult.

 

To be able to create this chart, you need some type of event in the data model, where each event has a start date (or time) and possibly also an end date. Further, an event should belong to some grouping, typically a project or a phase in time.

 

Gantt.png

 

Given the above, we can now start making the graph:

  • Create a bar chart with the appropriate event grouping as dimension (e.g., project, phase, or other group of events)
  • Add the duration of the project as expression: Max(EndDate)-Min(StartDate). If you only have one date per event, you just replace both StartDate and EndDate with the date that you have. The duration will then be the time between the first event and the last.
  • Add the start of the project as an offset to the bars: Min(StartDate). [Chart Properties-Expressions-The plus sign to the left of the Expression-Bar Offset]
  • Set the graph orientation to horizontal bars. [Chart Properties-Style-Orientation]
  • Remove the “Force 0” option. This option will force the start of the time axis to be Dec 30th 1899. [Chart Properties-Axes-Expression Axes-Force 0]
  • Format the expression axis labels as dates or as months (e.g. M/D/YY or YYYY MMM). [Chart Properties-Number-Date]

 

Now you should have a Gantt chart. If you want to improve the way it looks, you may want to consider the following suggestions:

  • Add a grid. [Chart Properties-Axes-Expression Axes-Show grid]
  • If you want a label on each bar, add a second expression defining the text for the label and use this as “Value on Data Points.” [Chart Properties-Expressions-Display Options]  Don’t forget to disable the “Bar” option for this expression. This is the first check box in the Display Options group.
  • If the chart shows a range which is too large, add static min and static max to define the display range of the expression, e.g. Min(StartDate)-5 and Max(EndDate)+40, respectively. The additional distance on the upper limit is to leave space for the text. The unit is number of days. [Chart Properties-Axes-Scale]
  • If you have a second dimension, you can add this too. But if you do, make sure you use the “Grouped” option and not “Stacked.” The latter does not work well with bar offsets. [Chart Properties-Style-Subtype]
  • You may want to use the same color within each value of the first dimension, e.g., one color per project. One good way to define the color (e.g. RGB values) is to do it already in the dimension table in the script and use this color in a color function in the bar background color, e.g. RGB (ProjR,ProjG,ProjB). [Chart Properties-Expressions-The plus sign to the left of the Expression-Background Color]

 

This Gantt chart solves most cases where you need to display that duration of a group of events. Should you need a more complex Gantt chart, you may need to make it as an extension object instead.

 

HIC

56 Comments
hic
Former Employee
Former Employee

Yes, you need to redefine the offets. In a stacked chart, the offsets are counted from the end of the previous segment, and not from zero level.

HIC

0 Likes
790 Views
bert_geraerts
Contributor II
Contributor II

I used this formula that I found in another example :

if(IsNull(above(Only(Project))), Min(StartDate),
RangeMax(0,Min(StartDate)-RangeMax(above(Max(EndDate),1,rowno()-1))))



0 Likes
790 Views
bert_geraerts
Contributor II
Contributor II

Already found the problem, the order of my records was not correct.

0 Likes
790 Views
Not applicable

Hi Henric,

How do you show the differences of duration between project 1 and project 2 in your Gnatt Chart ?'

As I need to display another bar chart showing the difference of duration between them.

Thanks

Chun Wey

0 Likes
790 Views
Anonymous
Not applicable

Hi Iam new to qlikview,and am following the blogs of Henric...can any body sent the sample data for creating gantt chart....it is very interesting......

Regards,

Amarnath.

0 Likes
790 Views
hic
Former Employee
Former Employee
0 Likes
790 Views
Anonymous
Not applicable

HI Henric,

Thank you for giving reply,but i was not installed the server edition working on personal edition. Could you please suggest how to clear the Gantt chart.

Regards,

Amarnath Dudyala.

0 Likes
765 Views
Not applicable

Hey Adam,

The link seems to be broken

I really liked this solution, do you know where I can find it now?

Thanks

0 Likes
765 Views
Not applicable

Hi All,

I am unable to get the Gantt chart. I was able to create it with Planned start and end date. However was unable to get it using 2 dates - planned start and end date  and actual start and end date. please help me fix this.

URL for uploaded .qvw : http://community.qlik.com/message/733010#733010

- hitha Dhani

765 Views
Not applicable

Wauw! Very nice! When I must make an Gantt Chart for school, it cost so much time and I think this is much better!

765 Views