Wednesday, November 21, 2007

How to create enterprise calculated filed in MS Project Server 2007

There are many times when we want to create custom calculated fields and share it with the rest of our organization in a MS Project Server environment; but how can we accomplish that?


First, we have to open MS Project Professional 2007 and go to Tools -> Customize -> Fields. In the custom fields dialog box, we need to select the field category (task, resource or project) and field type (cost, date, text, etc).




For the sake of this tutorial, we are going to create an enterprise task (text) field named El. Duration, which will calculate for us the elapsed days between the start and finish dates of a task.


Press the “Formula…” button to open the formula dialog box. From there you are able to create a formula, capable to calculate the elapsed days between the start and finish date of a task.


In the formula dialog box by pressing the function button, we can see the list of all available functions wecan use, in order to build our formula. Four our example we will choose the DateDiff function, which can support five entries: interval, date1, date2, firstdayofweek and firstweekofyear. We want to be able to measure the elapsed days in the day unit, so we set the first option (interval) to “d” which stands for days and our formula now looks like DateDiff(“d”;date1;date2;firstdayofweek;firstdayofmonth).




In order to figure out the naming conversion for the fields we want to use in our formula, we are pressing the “fields” button and we are now able to see all the available fields we can use in our formula. For our example we want the [start] and [finish] fields to be chosen, in order our formula to become like DateDiff(“d”;[start];[finish]) and to be able to calculate the elapsed days between start and finish dates of a task. For cosmetic purposes I am transforming the formula to DateDiff(“d”;[start];[finish]) & “d” to include the “d” character in future views.




The next step is to open the PWA page, with a project server administrative account, and go to Server Settings -> Enterprise Custom Field Definition. In the “New Custom Field” web page enter a name for the custom field (El. Duration for our example) and select the “formula” radio button. Copy and paste the formula created in project pro 2007 into the text box area and replace “;” character with “,” (see picture). In the “entity and type” section select as entity the “task” option and as type the “text” option and save the custom field definition.

No comments: