---
url: /cube-functions/if.md
description: >-
  Returns 1 if both the conditions are evaluated to true or if the cell being
  calculated has no elements which have children.
---

# IF

Returns 1 if both the conditions are evaluated to true or if the cell being calculated has no elements which have children.

```js
IF(condition, result_a, result_b)
```

#### Parameters

* `condition` - A condition which has to be evaluated.
* `result_a` - Result if the condition evaluates to 1.
* `result_b` - Result if the condition evaluates to anything other than 1.

#### Examples

```js
IF(["Measure A"] = 1, ["Measure B"], ["Measure C"])
```

**Result:** `3`

**Note:** If the value held at `Measure A` is equal to 1, `Measure B` is 3 and `Measure C` is 9 then the function will return the value held at `Measure B`.

:::tip
Other conditional functions can be used inside of IF function.
:::
