FACT DAX Function (Math and Trig)
Returns the factorial of a number, equal to 1*2*3*…* Number.
Syntax
| Parameter | Attributes | Description |
|---|---|---|
| Number |
The nonnegative number you want the factorial of. |
Return values
The factorial of the argument in a decimal data type.
Remarks
If Number is not an integer, DAX truncates it to an integer: FACT ( 4.9 ) returns 24, the same result as FACT ( 4 ). FACT ( 0 ) returns 1, and BLANK works as 0. A text that contains a number is converted to a number. If Number is negative, or if the result is too large, FACT returns an error.
The largest factorial that can be returned by FACT is 170!
The largest factorial that can be returned by FACT without loss of precision is 22!
This function is not supported in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.
Examples
-- FACT computes the factorial of a number
DEFINE
VAR Vals = GENERATESERIES ( 1, 21, 4 )
EVALUATE
ADDCOLUMNS (
Vals,
"Factorial", FACT ( [Value] )
)
| Value | Factorial |
|---|---|
| 1 | 1 |
| 5 | 120 |
| 9 | 362,880 |
| 13 | 6,227,020,800 |
| 17 | 355,687,428,096,000 |
| 21 | 51,090,942,171,709,440,000 |
-- FACT truncates a number that is not an integer: 4.9 works as 4.
-- FACT ( 0 ) returns 1, and 170 is the largest valid argument.
EVALUATE
SELECTCOLUMNS (
{ 0, 4.9, 22, 170 },
"Number", [Value],
"Factorial", FACT ( [Value] )
)
| Number | Factorial |
|---|---|
| 0 | 1 |
| 4.9 | 24 |
| 22 | 1,124,000,727,777,607,680,000 |
| 170 | 7.257415615308E+306 |
Last update: Nov 26, 2026 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo, Kenneth Barber,
Microsoft documentation: https://learn.microsoft.com/en-us/dax/fact-function-dax