# Configure calculated column (formula)

Modified on Mon, 16 Aug 2021 at 09:21 AM

```
"columns": [
...
{
"filterable":true,
"bindings": "rpn",
"type": "int",
"cellRenderer": "rpn",
"width": 60,
"level": 2,
"formula":"commonRpn"
},
...
```

It is possible to configure column so the values (cells) will be calculated automatically based on the other columns.

## Config file

Please follow this article, to learn where is the configuration file located, see:  Configure risksheet columns

## Example: RPN Number

A reference example is the RPN columns where the value is calculates as value of Severity column multiplied by Occurence column, multiplied by Detection column.

RPN = Severity * Detection * Occurence

## Configuration

To configure the column formula you would need to:

1. point a column to a formula definition
2. define the formula

```...
"formulas":{
...
"commonRpn":"function(p){\n var value = p.item['occ']*p.item['det']*p.item['sev'];\n return value?value:null;}",
...
},
...

"columns": [
...
{
"filterable":true,
"bindings": "rpn",
"type": "int",
"cellRenderer": "rpn",
"width": 60,
"level": 2,
"formula":"commonRpn"
},
...
]
....```

• You see that column.formula is pointing to formula ID: commonRpn
• commonRpn is a function defined in section called: formulas
• the function is defined in javascript language and needs to return a value (can be number, string, ...)

## Formula Function Parameter

In the example above you can see that the formula function takes as an input one parameter (here it is called p).

This parameter exposes:

• p.item - a data array, that holds the values of rows. So in your formula, you can access the row (item) values by calling p.item[column.id]
• p.cell - a HTML DOM element, usually not used in formulas, but this is used typically in cellDecorators

## Store or Not-to-store the results into Work Item

You can configure the Risksheet to store the calculated columns in Polarion. To do so, mark the column as "readOnly":false

```...
"columns": [
...
{
"filterable":true,
"bindings": "rpn",
"type": "int",
"cellRenderer": "rpn",
"width": 60,
"level": 2, 