---
url: /technical/cube-validation-formula.md
---
# Formula Validation

### Why a Formula Validation

A formula validation provides more flexibility than a simple validation. Rather than always presenting the same fixed list, a formula validation lets the list of valid options change dynamically, depending on the value of another cell or the current dimension context.

Formula validations utilise the MODLR formula system.

### Creating a Formula Validation

Consider a cube with a Scenario dimension, where the set of valid months should differ depending on whether the current Scenario is Actual or Budget.

The "Time by Scenario" hierarchy contains two parents: one grouping "Actual Months" and one grouping "Budget Months".

![Time Month by Scenario](/time-monthlist-by-scenario.png)

In the workview, open the **Validation** tab on the workview to configure a rule against the **Time Mapping** measure. Instead of selecting a fixed list, this time the rule is defined using the **Formula** field, referencing the Scenario dimension to determine which parent's children should be valid.

![Cube Data Formula Validation](/data-validation-formula.png)

Once saved, switching the Scenario context changes the list of valid options presented at data-entry:

![Data Validation Selection Budget](/data-validation-select-budget.png)
![Data Validation Selection Actual](/data-validation-select-actual.png)

The validated string measure now displays a dropdown list of Months scoped to the current Scenario.

::: tip Scoping a formula validation to the current user
The Scenario dimension isn't the only thing a formula validation can key off. Using the reserved `user-id` variable, the same Formula field can scope the valid options to whoever currently has the Workview open instead of a dimension in context - see [User-Based Validation](/technical/cube-validation-user-based).
:::
