Learn more about the four core Coding metrics in Flow

## Rework and efficiency

Rework is code deleted or rewritten shortly after being written. Learn more about rework.

**Rework formula:**

Rework % = 100*(rework HALOC/total HALOC)

Rework HALOC is the number of reworked lines of code. Total HALOC is the total lines of code.

Efficiency is the percentage of code that stays in the code base compared to rework. It is rounded up to the nearest percentage.

**Efficiency formula:**

Efficiency % = 100-Rework% = 100*(1-(rework HALOC)/(total HALOC))

You can calculate efficiency for individuals or teams. For organization and team calculations, rework HALOC is the sum of the reworked lines of code for each engineer. Total HALOC is the sum of the total lines of code for each engineer.

## Commits per day

Commits per day is the average of included commits a developer submitted on days they committed. Learn more about Commits per day.

## Coding days per week

Coding days per week is the average number of days in a week where a developer commits code. Learn more about Coding days.

## Impact

Impact is the severity of edits to the codebase, as compared to the repository history. Learn more about Impact.

**Formula:**

Impact per week = sum(impact)/(total_weeks)

Total weeks is the total number of days in the period minus days during weeks where no code was committed.

Individual Impact is the sum of the developer's Impact during the period.

For organization and team calculations, Impact is the sum of the Impact for the individuals for the selected time. Total days is the total developer days for each engineer in the period.

## How are team averages calculated?

Let’s take a deeper look at how these formulas work for team calculations, using an example. Pay special attention to how Flow handles weeks with no Coding days.

In this example, we’ll look at Impact.

**Impact Formula:**

Impact per week = sum(impact)/total_weeks

Let's say we have two engineers on a team. One engineer has an Impact of 100 on a particular week. The other engineer has an Impact of 50 on that same week. The following week, the first engineer takes some much needed PTO and therefore has an Impact of zero. The second engineer has an impact of 80.

Here’s how Flow calculates the average weekly impact for that team:

- Calculate
**I****mpact**. Flow sums the total Impact of each team member during the time period. Here the total Impact would be 100 + 50+80 = 230. - Calculate
**total weeks**. Flow then takes the sum of the total potential days each engineer could have committed code during that time period and divides it by seven. In this case, each engineer had 14 days. As a team of two engineers, it’s 2*14 = 28 days. - Calculate
**total days**. In this case, one engineer took the entire second week off. The**total days**is therefore reduced to 28-7 = 21 days, or three weeks. - Calculate
**average Impact per week**. Flow divides the total team Impact by the number of weeks found in step 3. Here, we get 230 / 3 ≅ 77 in average Impact per week.