FACT DAX Function (Math and Trig)

Returns the factorial of a number, equal to 1*2*3*…* Number.

Syntax

FACT ( <Number> )
Parameter Attributes Description
Number

The nonnegative number you want the factorial of.

Return values

Scalar A single decimal value.

The factorial of the argument in a decimal data type.

Remarks

If the number is not an integer, it is truncated and an error is returned. If the result is too large, an error is returned.

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 21!

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

Last update: Nov 14, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo, Kenneth Barber,

Microsoft documentation: https://docs.microsoft.com/en-us/dax/fact-function-dax

2018-2024 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of FACT? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.