> ## Documentation Index
> Fetch the complete documentation index at: https://help.gowindmill.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Computed questions

> Calculate an answer from the other answers in a review.

A computed question gets its answer from a formula. Reviewers do not answer it. Windmill calculates the answer from the other answers in the same review. Use computed questions to show an overall score, a weighted rating, or a label that comes from a score.

> [!NOTE]
>
> Computed questions are not available in all workspaces. If you do not see the **Computed** option, contact your Windmill team.

## How computed questions work

* A formula can only read answers from the same review form. It cannot read answers from other stages, other reviewers, feedback, or goals.
* Windmill calculates the answer each time the reviewer saves a draft. The reviewer cannot change the answer.
* A computed question is never required, because its answer can be empty.
* A formula can read other computed questions. A formula cannot read itself, directly or through other questions.
* A form must have at least one question that the reviewer answers.

### Example

A manager review has two Rating questions: **Quality of work** (question 1) and **Impact** (question 2). You want an overall score that gives 60% weight to quality and 40% weight to impact, with one decimal place:

```
ROUND(ANSWER("Q1")*0.6 + ANSWER("Q2")*0.4, 1)
```

If the manager selects 4 for quality and 3 for impact, the computed answer is 3.6.

## Add a computed question

You can add computed questions to Self, Peer, Manager, and Upward review stages. You can add them when you create a cycle, when you edit a recurring review, or on the questions page of an existing stage. Only cycle admins can add or change computed questions.

**1. Open the questions for a stage**

In the cycle setup, go to the question step for the stage. For an existing cycle, open the stage and edit its questions.

**2. Click Add question, then select Computed**

You can also change the type of an existing question to **Computed**. After the stage starts, the button is **Add computed question**.

**3. Enter a title and description**

The title and description show to reviewers, as on other questions.

**4. Select the answer type**

Choose the type of answer that the formula gives. See [Choose an answer type](#choose-an-answer-type).

**5. Write the formula**

Describe the calculation and let Windy write the formula, or type the formula yourself. See [Write a formula](#write-a-formula).

**6. Test the formula in the preview**

Enter example answers and make sure that the result is correct.

**7. Click Apply formula, then save**

You must apply each formula that you type before you can save the questions. A formula from Windy is applied when you click **Use formula**.

### Choose an answer type

In **Answer type**, select one of these types:

* **Number:** The default type. You can set a **Range** with a **Min** and **Max**, a **Unit**, and **Whole numbers only**.
* **Single select:** The formula gives one of the options of this question. Add the options in the options editor.
* **Yes/No:** The formula gives yes or no.
* **Text:** The formula gives text, for example a label that you join from other answers.

Only these four types are available. If you change a Scale, eNPS, Rating, or Multi-select question to **Computed**, it becomes a **Number** question. A date question cannot be computed.

If the formula gives a result that does not fit the answer type, the answer stays empty. For example, a decimal result is empty when **Whole numbers only** is on.

### Show or hide the formula from reviewers

**Show the formula to reviewers** is on by default. When it is on, reviewers see the formula when they hover over the computed answer. When it is off, reviewers see only the answer.

## Write a formula

### Let Windy write the formula

**1. Describe the calculation**

In **Describe the calculation**, write what you want in plain words. For example: "The average of quality and impact, rounded to one decimal."

**2. Click Write formula**

Windy writes a formula and explains it.

**3. Click Use formula or Discard**

**Use formula** applies the formula. Check the result in the preview.

If Windy cannot write the formula, change the description and try again, or type the formula yourself.

### Type a formula

Click **Show formula** to open the formula editor. Use **Add a variable** to insert a reference to a question. Function names are not case-sensitive.

**References**

* `ANSWER("Q1")`: The answer to question 1. The number is the position of the question in the form, and computed questions count too. Reviewers see no numbers on computed questions, so this number can be different from the number that reviewers see.
* `OPTION("Q1", "Label")`: One of the options of question 1. Only Single select, Multi-select, and Rating questions have options. For a Rating question, an option gives its point value.

**Values**

* Numbers, text in straight double quotes (`"text"`), `TRUE`, `FALSE`, and `NULL`.
* Lists in square brackets, for example `[ANSWER("Q1"), ANSWER("Q2")]`.

**Operators**

* Arithmetic: `+`, `-`, `*`, `/`, `%`, `^`
* Comparison: `==`, `!=`, `<`, `<=`, `>`, `>=`
* Logic: `AND`, `OR`, `NOT`

**Functions**

| Group | Functions |
| - | - |
| Math | `SUM`, `SUBTRACT`, `MULTIPLY`, `DIVIDE`, `MOD`, `POW`, `ROOT`, `SQRT`, `CBRT`, `ABS`, `NEGATE`, `RECIPROCAL`, `LOG`, `LN`, `LOG10`, `EXP` |
| Rounding | `ROUND(value, digits)`, `FLOOR` (round down), `CEIL` (round up), `TRUNC` |
| Lists | `AVG`, `TOTAL`, `MIN`, `MAX`, `COUNT`, `CONTAINS`, `CONTAINS_ANY`, `CONTAINS_ALL` |
| Empty answers | `EXISTS`, `NOT_EXISTS`, `IFNULL` |
| Text and conversion | `CONCAT`, `TEXT`, `NUMBER` |
| Conditions | `IF`, `MAP`, `BAND` |

### Use conditions

* `IF(condition, result, else result)` gives one of two results. You can also write `IF condition THEN result ELSE result END`, with more `ELSE IF` parts.
* `MAP(input, [[key, result], ...], else result)` gives the result for a matching key.
* `BAND(input, [[upper limit, result], ...], else result)` gives a result for a range of numbers. Each upper limit is not included in its band. Put the limits in ascending order.

For example, this formula gives a label from the overall score in question 3. The labels must be options of the computed question:

```
BAND(ANSWER("Q3"), [[2.5, OPTION("Q4", "Below expectations")], [4, OPTION("Q4", "Meets expectations")]], OPTION("Q4", "Exceeds expectations"))
```

### Questions a formula can read

* **Number, Scale, eNPS, and Rating:** Read as numbers.
* **Single Select and Multi-Select:** Read as options.
* **Yes/No:** Read as `TRUE` or `FALSE`.
* **Text:** Read as plain text.

A formula cannot read Date questions.

### Test the formula in the preview

The **Preview** panel shows a field for each question that the formula reads. Enter example answers to see the **Result**. If there is no result, the preview tells you why:

* An answer that the formula needs is empty.
* An answer that the formula reads does not fit its question.
* The result does not fit the answer format of this question.
* Division by zero.

## Answer a review with computed questions

Reviewers do not answer computed questions. The computed answer shows as a read-only tag with a formula icon.

* **Updates:** Windmill recalculates the answer each time the review saves. While it saves, the earlier answer shows dimmed. If there is no earlier answer, it shows **Updating...**.
* **Empty answers:** If the formula gives no result, the computed answer shows **Not available yet**. For example, an answer that the formula needs is empty, or the formula divides by zero. It updates when the reviewer answers the questions that the formula reads.
* **Formula details:** If the formula is visible, the reviewer can hover over the answer to see how Windmill calculated it. For a weighted score, the tooltip shows each question, its answer, its weight, and the total.

Computed questions do not have a question number in the review form.

## See computed answers in results

* **Review packets:** Computed answers show in review packets with the other answers from their stage. If you add a computed question after the cycle is created, employees cannot see it until you add it to the employee packet in the packet settings. The question editor shows this note on a new computed question.
* **Calibration:** Facilitators cannot change a computed answer directly. When they change an answer that the formula reads, the computed answer updates. In the table view, hover over the answer to see its earlier value.
* **Insights:** Computed answers show with a formula icon.

Computed answers follow the same visibility rules as other answers. The formula is hidden if **Show the formula to reviewers** is off. It is also hidden if the formula reads a question that the viewer cannot see.

## Change computed questions after launch

Cycle admins can add, remove, and change computed questions on a live cycle, because Windmill recalculates their answers. This includes cycles after a stage starts and completed cycles. You cannot change questions on an archived cycle.

When you change a formula, Windmill recalculates the answer in every review in the stage, including submitted reviews.

You cannot change a manual question to a computed question, or a computed question to a manual question, after the stage starts. For other limits on changes, see [Questions and rating scales](https://help.gowindmill.com/features/performance-reviews/questions-and-rating-scales.md#change-questions-after-work-starts).

## FAQs

> [accordion] Can a reviewer change a computed answer?
>
> No. Windmill calculates the answer from the other answers. To change it, the reviewer changes the answers that the formula reads.

> [accordion] How do I give questions different weights?
>
> Multiply each answer by its weight and add the results. For example, `ANSWER("Q1")*0.6 + ANSWER("Q2")*0.4`. If the weights are positive and add up to 1, reviewers see them as percentages when they hover over the answer.

> [accordion] What happens when an answer is empty?
>
> Most formulas give an empty result if an answer they read is empty. `AVG`, `TOTAL`, `MIN`, and `MAX` give an empty result if any item in the list is empty. A blank Text answer is empty. To use a default value, use `IFNULL`, for example `IFNULL(ANSWER("Q1"), 0)`.

> [accordion] How does rounding work?
>
> `ROUND(value, digits)` rounds half away from zero. For example, `ROUND(2.5, 0)` gives 3. The digits can be from -14 to 6.

> [accordion] What happens if I delete a question that a formula reads?
>
> Windmill asks you to confirm and shows the formulas that read the question. After you delete it, change those formulas before you save.

> [accordion] Can a formula use answers from a different stage?
>
> No. A formula can only read questions in the same stage. For example, a manager review formula cannot read the employee's self review answers.

> [accordion] Why does the save bar say to apply the formula?
>
> You changed a formula but did not apply it. Click **Apply formula** on the question, then save.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.