Power BI: gantt (timeline) chart

To create an event, project or task timeline chart, I will use the Microsoft gantt chart, I have to download it because it is not available by default. Click on the 3 dots then on “get more visuals” (left picture). Search for it (more information, go to its webpage Microsoft Gantt) then once done, it will appear (right picture):

power bi power bi

I have this table:

power bi

NOTE:

  • “end date 1” has minimum 1 event with the same day as “start date”
  • “end date 2” has different days for all events than “start date”

I will create the chart using the “end date 1”:

power bi

Automatically, it adds 1 day for “end date” because of the default “duration unit” configuration. For instance, if I move my mouse above INC001, the popup is showing this information:

power bi

It is not matching at all the correct “end date” in my table. In the other hand, if I use “end date 2” instead of “end date 1”, the chart is showing correctly the information:

power bi

To resume, if one of my events has the same day (it doesn’t matter the time) for “start date” and “end date”, I need to follow those steps below to get it correctly. In the other hand, if all my events have different days, the information will be correct.

Click on “format your visual” then expand “general”. In the “duration unit” field, by default, “days” is selected:

power bi power bi

As said above, this is the correct configuration if none of the “end date” of my events have the same days as “start date”. If I have at least minimum 1 event in which the “end date” day is the same as “start date” and it lasts in minutes, I will select “minutes”:

power bi

As we can see, it displays correctly the information. Now, if I select “hours”, it will add automatically 1 hour for my “end date”:

power bi

As you may guess, I will select this option only if I have minimum 1 event that lasts in hours and none in minutes for the same day. 2 things I like to show, it is the progress of the event and more details. For the progress, I will use this formula:

var inprogress=DATEDIFF([argument1],NOW(),MINUTE)
var intotal=DATEDIFF([argument1],[argument2],MINUTE)
Return
IF(NOW()>=[argument2],1,IF(NOW()<[argument1],0,inprogress/intotal))

NOTE: the formula is the same for minutes, hours and/or days and don’t forget to format it in percentage

end date 1 end date 2
power bi power bi

I will put it in “% completion”:

power bi
power bi

For more details, I just have to use the “tooltips” field:

power bi
power bi

Don’t doubt to play with its configuration to personalize your chart.

Interesting Topics