# Matrix: using historical calculation fields in a matrix

## If you are creating a Matrix with Historical calculations in the matrix you need to ensure that the first field name is labeled correctly

You MUST name the cells in your matrix correctly so that they can be referenced correctly in any subsequent historical calculations.

It is important that you have the name of the first cell set up correctly. Name the field by the column name and then the row name.

For example, if the first cell is for Time 1 and Run, it must be called Time 1 Run. Do not just name it Run or Time 1.

When you set up your matrix (as shown in the image in the step below) you can name the rest of the columns and rows accordingly.

## Set up the field types (e.g as numbers, a sum or historical calculation)

The example here shows Historical calculations being set for the Last 7 and the Historical field.

## Once you create your matrix you need to add in the calculations for any of the Sum or Calculation fields

If you set up any fields as being a sum, average or historical calculation then you need to set up the calculations for each of these fields (as shown in the image in the step below).

## Set up the historical calculation correctly. Make sure you can distinguish between the Historical Field names and the Fields which reference Historical values for each of the fields

The example here shows the calculation for the field "Last 7 Run". This is to calculate the historical sum from the last 7 days from the Time Sum Field. You can see in the historical calculation field, historical values can be selected to included in the calculation. It is important that you have clearly named the fields so the system can detect the difference from a "Historical Value" (that pulls through historical data) and the field name "Historical".

## Once you set up all of your calculations you will need to test that your historical values are being calculated correctly. This can only be done in the main system

When you enter in new data into the form, the historical calculation will not calculate until you actually save the form. It calculates the historical fields when you have two of more entries in the system for the athlete.

## Once you enter in your testing data you can check that the historical calculations are working correctly

Historical calculations will appear on the second record for the athlete (the first record entered has no historical data so it will be blank). When you open that record after it has been saved, the data will appear (as shown in the image in the step below).