---
title: "factorial function in Strata | Oplema"
description: "Calculate the factorial of a whole number, such as 24 from an input of 4. Write it as factorial(x) in a Strata Formula or Filter."
url: "https://oplema.com/docs/strata/functions/factorial"
updated: "2026-11-04"
---

# factorial

Multiply a whole number by every whole number below it, down to 1.

## Try an expression

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

### Expression

```
factorial(4)
```

### Result

```
'24'
```

The expression returns `HUGEINT`. Formula stores it as `VARCHAR` in this example. To use your own data, replace the example values with column names. Keep format strings and other options as written.

Try it live in Formula

Result
| id | result |
| --- | --- |
| 1 | 24 |

## Arguments and types

```
factorial(x)
```

**x**

Number

Supported signatures (1)

```
factorial(x: INTEGER) → HUGEINT
```

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

## Things to know

If the first argument is missing, the result is NULL.

## Related functions

[acos

Computes the arccosine of x.

](https://oplema.com/docs/strata/functions/acos)[acosh

Computes the inverse hyperbolic cos of x.

](https://oplema.com/docs/strata/functions/acosh)[asin

Computes the arcsine of x.

](https://oplema.com/docs/strata/functions/asin)[asinh

Computes the inverse hyperbolic sin of x.

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

[Browse numbers](https://oplema.com/docs/strata/functions#numbers) [DuckDB documentation](https://duckdb.org/docs/current/sql/functions/numeric.html#factorialx)

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