Server Administration > Calculations in Fields, Charts, and Reports > Using Computed Fields to Calculate State Metrics
  
Using Computed Fields to Calculate State Metrics
Using external information functions in computed fields, you can generate state metrics. State metrics are useful for determining item responsiveness. For example, you could use the DaysInState(state-name) function in a computed expression to calculate how many days a Defect item has been in the In Development state. The computed value is then stored in the computed field. For more information on creating computed fields, see Creating a Computed Field.
Other possible metrics you can generate about your workflow are:
how long an item stays in the workflow cycle
how many times an item goes through the workflow cycle
how many state transitions an item goes through
the number of items that have not been modified in a certain time period
The following external information functions are applicable to state metrics:
DaysCurrentState()
DaysCurrentPhase()
DateFirstEntered(Submit)
DateLastEntered(Submit)
NumberOfEntriesToState(Submit)
NumberOfHistoryEntries()
NumberOfModifications(fieldName)
DaysInState(Submit)
DaysInPhase(Terminal)
For detailed information on the external information functions applicable to state metrics, see Computed Expression Function Classes.
If you are using Windchill RV&S’s configuration management and workflow and document management functionality, you can also generate the following types of metrics:
Project metrics extract information from change packages to report how an individual project is progressing.
Code metrics extract information from source code to report on a product’s status, also known as Portfolio Metrics.
Example
In the ABC Financial organization, a Defect type typically goes through the following workflow:
Posted (initial state)
In Development
In QA
Fixed (terminal state)
Scenario 1
To determine how many days a Defect spends in the Development phase, you create a computed field named Fix Time with the following underlying expression:
daysInPhase(Development)
Next, you query on Defects by the Fix Time field. To create a query, see the User documentation.
Using the query you created, you create a report or chart that summarizes the query data. To create a report or chart, see the Reports or Charts information in the User documentation.
Scenario 2
To determine how many times a Defect went through the complete workflow cycle, meaning the number of times a Defect went from Posted to Fixed, you create a computed field named Number of Times Through the Workflow with the following underlying expression:
numberOfEntriesToState(Posted)
Next, you query on Defects by the Number of Times Through the Workflow field. To create and run a query, see the Queries information in the User documentation.
Using the query you created, you create a report or chart that summarizes the query data.