---
title: "CASE in Strata | Oplema"
description: "Choose a result using one or more conditions, with an optional fallback when none match. Use it in a Strata Formula or Filter."
url: "https://oplema.com/docs/strata/functions/case"
updated: "2026-11-04"
---

# CASE

Choose a result using one or more conditions.

## Try an expression

In [Formula](https://oplema.com/docs/strata/prep/formula), enter the expression and set Output type to **VARCHAR**.

Example input

1. Row 1 `amount = 20`
2. Row 2 `amount = 120`
3. Row 3 `amount = NULL`

### Expression

```
CASE WHEN amount > 100 THEN 'high' ELSE 'low' END
```

### Result

```
Row 1: 'low'
Row 2: 'high'
Row 3: 'low'
```

NULL means the value is missing.

Try it live in Formula

Result
| id | amount | result |
| --- | --- | --- |
| 1 | 20 | low |
| 2 | 120 | high |
| 3 |  | low |

## Arguments and types

```
CASE WHEN condition THEN result ELSE fallback END
```

The result type can depend on the input types. See DuckDB for the full argument rules.

## Related functions

[if

Choose between two values using a condition.

](https://oplema.com/docs/strata/functions/if)[BETWEEN

Check whether a value falls within an inclusive range.

](https://oplema.com/docs/strata/functions/between)[coalesce

Replace missing values with the first available alternative.

](https://oplema.com/docs/strata/functions/coalesce)[ifnull

Use a fallback when a value is missing.

](https://oplema.com/docs/strata/functions/ifnull)

[Browse conditions & missing values](https://oplema.com/docs/strata/functions#conditions-&-missing-values) [DuckDB documentation](https://duckdb.org/docs/current/sql/expressions/case.html)

Function metadata from DuckDB, used under the [MIT license](https://github.com/duckdb/duckdb/blob/v1.5.4/LICENSE).
