Carrot reference
Functions

turnoverRate()

Calculates a turnover rate (also known as attrition rate), used to measure the rate of employee departures.

Turnover is calculated as the number of departures that occurred over a period of time, divided by the average of headcount at the start of the period and the headcount at the end of the period.

  • For example, if measuring turnover in calendar year 2025, if the organization:
    • began the year on with 100 people on Jan 1
    • saw 20 departures through the course of the year
    • ended the year at 150 people on Dec 31
    • Then turnover rate is 20 / ((100 + 150) / 2) = 16%.

Syntax

turnoverRate(fromDate, untilDate[, jobFilter][, departFilter][, groupBy])

Parameters

Parameter

Types

Description

fromDate

Date or String

The starting-point date (inclusive) of the interval being measured for turnover. For example if measuring turnover in the calendar year 2025, this would be 2025-01-01

untilDate

Date or String

The ending date (exclusive) of the interval being measured for turnover. For example, if measuring turnover in the calendar year 2025, this would be 2026-01-01.

jobFilter

@Expression

An expression to filter which jobs will be included in the calculation. For example, if excluding contract roles or interns from the calculation, could use {!employment:contract,intern}

departFilter

@Expression

An expression to filter what types of departures will be included in the calculation. For example, if only including voluntary departures, could use {depart:voluntary}

groupBy

@Expression

If used, will group the results by the expression. For example, if calculating turnover rate broken down by gender, you could pass {gender}

Returns

Number if the groupBy parameter was not used, or an @AggregatedResult if the groupBy parameter was used.

The result will be the calculated turnover value over the period of time.

Examples

Within a dashboard, overall annual turnover:

`turnoverRate('-1y+1d',



date() returns the current date.

date("-3m") returns the date three months ago

date(1744206569) returns the date of April 9, 2025 (by converting from a unix timestamp)

date("2025-12-25") returns the exact date of Dec 25, 2025

date("+6w", createDate) returns a date six weeks from the value of createDate.