Still working on documenting the instructions from the Houston MPUG event a couple of weeks ago. It’s amazing how much can be condensed into a one hour presentation. Today’s post is about formatting the Gantt chart, which is a popular topic in many of the sessions I teach. Note that this posting is meant to capture a couple of the elements that many people use in formatting the Gantt, but is not meant to be exhaustive. There are a number of ways to modify it beyond what I discuss below which provide much value to the end user.
Note that before we get into the instructions, the demonstration file can be downloaded here.
The first thing we need to do is to copy the default Gantt chart. We do this to ensure that we always have a copy of the original view to work from. In this case, I am going to make a new view called “_COUNTRIES.” Note that in a Project Server environment, if I am making this view on my local project, I might using a naming convention such as “_AL_COUNTRIES,” using my initials to signify that the view is a local view, and not an enterprise view.
To make a copy, open Microsoft Project, navigate to Views > More Views > Copy, and then copy the Gantt Chart.
At this point, you probably should also make a copy of the Entry table, as we’re going to add a couple of fields for demonstration purposes. To create a new table, we go to View > Tables > More Tables and copy the Entry table. We will call the new table “_Countries”. You might want to go back into the _Country view and make sure it defaults to your new table.
Now that we have a copy, we can begin to modify it…
Modifying the Bar Styles
Modifying bar styles is quite simple. The trick is understanding that the Gantt can actually be controlled using the custom local Flag fields. Here is an example I typically use in presentations. I don’t expect it to be a real world example, but it’s a nice visual way to get the point across. In this scenario, we have a project with tasks in four countries: The USA, China, Canada, and Mexico.
I create a custom Text field called “__Country” to track which country the task is performed in. Note that this is not required, I can perform the same logic against other fields such as the WBS, the Resource Name, or even the Resource Group field. To create a new custom field, I go to Tools > Customize > Fields, and select a Text field in the top right drop down.
We need to plan how many custom flag fields we need. In this case, we have five potential states for the _Country field:
As the flag fields can only have two states (Yes or No), I need to use a combination of three flag fields to generate the number of permutations required to capture each of the field states.
So now I have a code for each country. USA is YYN, Canada is YNN, etc. I need to make sure that each country has it’s own distinct code.
Going back to Microsoft Project, I now implement the appropriate formulas for each of the custom flag fields. As I do this, I change the name of the fields to “_CI1,” “_CI2,” etc., where “CI” stands for Country Indicator.
Flag 1: IIf([Text1]=”USA”,Yes,No) Or IIf([Text1]=”Canada”,Yes,No)
Flag 2: IIf([Text1]=”USA”,Yes,No) Or IIf([Text1]=”Mexico”,Yes,No)
Flag 3: IIf([Text1]=””,Yes,No)
Right clicking on the Gantt, I choose the bar styles option. The default should look like this:
I then modify the bar styles as follows. Note that for the complete instructions, you will need to check out the accompanying solution file which can be downloaded here.
And now, as I toggle the _Countries field, the Gantt bars will change accordingly:
On to more practical matters perhaps. How does this feature work for many companies? Here’s a couple of options, all created using the same functionality and technique:
This is a view that is popular with many engineering organizations. In this case, the task is a line with triangles at the start and finish. If the task is started, the initial triangle is filled in, and if the task is completed, the final triangle is filled in.
in this view, we create a custom field to capture the project phase. Then we use this field to drive several flag fields as in the above example, and drive the Gantt Chart formatting:
Caveats (Project Server)
Note that if you are using Microsoft Project Server, and attempting to deploy custom views such as this using Enterprise fields, you will have an additional challenge. The Gantt chart cannot be driven by Enterprise fields. Thus you have a couple of options:
1) Simply build the views so they are driven by local fields, and make sure those formulas are captured in the project schedule templates.
2) Create a macro to copy the Enterprise values to local flag field values.
One more element that is commonly used are Gantt chart gridlines. To get these, right click on the Gantt chart, and select Gridlines. There’re a couple of options which I see most commonly:
….and horizontal gridlines:
Both of those should be considered as standard parts of almost any Microsoft Project Server or standardized template deployment.
As mentioned above, please download the demonstration file here.