Get started > Reports > How to use duration based calculated fields in reports

How to use duration based calculated fields in reports

You can use duration based calculated fields in analytic reports to help present the information you need, in the way you want. The following sections discuss some of the practical considerations and techniques.

Duration and calculated fields

Let’s assume you want to know how long change records stay in the Plan phase. To find this out, you create a calculated field using the Phase duration template, and selecting the Plan phase. You call the calculated field Duration of Plan phase.

Having created the calculated field, you then create a report displaying changes, and using this field.

It is likely the report will include a number of changes for which the Duration of Plan phase is zero. What does that mean?

The possible explanations for Duration of Plan phase being zero are as follows:

  • The change record never was in the Plan phase.

  • The change record is still in the Plan phase.

    The way that Service Management calculates duration is to measure the time between entering and exiting the selected phase. If a record remains in the phase – and so has not yet exited - its duration is not calculated.

    See the following:

    Duration not calculated, and duration calculated

    Also, note that if a record is in a particular phase more than once, Service Management measures the cumulative duration in that phase.

Note Calculated fields only apply to records created after the creation of the calculated fields. For example, assume change record 111111 was created before a new calculated field like Duration of plan phase. In change record 111111 there is, therefore, no value for Duration of plan phase.

In the next section, there is an example of one way to improve the display of data to take account of the records that remain in the Plan phase.

How to improve a duration based report

Let’s continue the example from the preceding section, and assume you want to know how long change records stay in the Plan phase. The following steps are one way to help improve the accuracy and usability of the information.

Step 1: Create the calculated field - Duration of Plan phase

  1. From the main menu, select Administration > Configuration > Studio > Fields.

  2. Select Change in the drop-down list at the top of the page.

  3. Click New calculated-field.

  4. Select Phase duration from the list of templates that is displayed.

  5. In the template:

    1. Click phase.

    2. Select Plan from the drop-down list.

    3. Click OK.

  6. Click Create.

Step 2: Create the calculated field - Was record in Plan

  1. If not already there:

    1. From the main menu, select Administration > Configuration > Studio > Fields.

    2. Select Change in the drop-down list at the top of the page.

  2. Click New calculated-field.

  3. Select Was record in phase from the list of templates that is displayed.

  4. In the template:

    1. Click phase.

    2. Select Plan from the drop-down list.

    3. Click OK.

  5. Click Create.

Step 3: Create the report

  1. From the main menu, click Reports to open the Reports page.

  2. Click to expand the left pane (Reports list).

  3. In the left pane, click New.

  4. Select Analytic report.

  5. The New report dialog box is displayed.

  6. Complete the following in the General tab:

    Field Action
    Report name Type a suitable name.
    Display label Type a suitable label.
    Record type Select Change.
    Filter by Select Was record in Plan, then Yes.
    Group by Click Add group, then select Duration of Plan phase.
    Function Leave as displayed by default, or configure as required.
    Additional table columns Leave as displayed by default, or configure as required.
    Display results Leave as displayed by default, or configure as required.
    Enable chart view True (Default).
    Add to dashboard Select if required (Optional).
  7. Click Save.

How to use other duration templates

You can use the same technique as in the preceding section to sharpen the available data using the Duration between phases and Duration between events templates for calculated fields.

In such cases, instead of using the Was record in phase template as in Step 2, above, you should use the Was field assigned with value template.

For example, assume you use Duration between phases to measure the duration between change records:

  • Entering the Plan phase, and

  • Exiting the Build and test phase.

To follow the example shown in How to use duration based calculated fields in reports, you would create an additional calculated field, using the Was field assigned with value template, to match the phase that would start the duration. In this case, Was Phase Id assigned with Plan.

Related topics