Serververwaltung > Calculations in Fields, Charts, and Reports > Using Computed Fields to Chart Historical Trends > Example: Using Computed Fields to Chart Historical Trends
  
Example: Using Computed Fields to Chart Historical Trends
Using the im analytics --recomputehistory command from the command line interface, this example illustrates how to determine the historical trend for defects in projects.
1. Create a new type to represent projects, for example, Project.
2. Create some Project items to represent projects.
3. Create a computed field, for example, Defect Count, that calculates the number of defects related to each project:
im createfield --type=integer --computation='Query("Financial Toolkit
Defects: In Dev", Project, count())' --name='Defect Count'
4. Make the Defect Count field visible in the Project type only.
5. Project the Defect Count field back to a retroactive date:
im analytics --recomputehistory –-starttime=06/01/2002 –-endtime=08/24/2009
–-increment=1 –-incrementtype=week –-field='Defect Count'
6. Create a query that lists all Project items, for example, All Projects.
7. Create a chart:
im createchart –-trendstep=week –-charttitle='Defect Count' --startdate=06/01/2002
–-enddate=02/01/2009 –-computations='"Defect Count"' –-query 'All Projects'
–-charttype='Item Fields Trend' --issueidentifier {Summary}