DAX Math & Trigonometric - RAND function



Description

Returns a random number greater than or equal to 0 and less than 1, evenly distributed.

The number that is returned changes each time the cell containing this function is recalculated.

Syntax

RAND ()

Parameters

No parameters for this function.

Return Value

A decimal number between 0 and 1.

Remarks

DAX RAND function will be recalculated when the entire column is recalculated. This can happen in the following situations −

  • When the data from an external data source is refreshed.

  • When the DAX formulas that contain RAND function are edited, causing reevaluation of formulas.

DAX RAND function will always be recalculated, if the function is used in the definition of a calculated field. Also, in such contexts the RAND function cannot return a result of zero, to prevent errors such as division by zero.

However, DAX RAND function will not be recalculated when the execution of a query or filtering happens.

Example

= RAND () * 100 returns 51.2418613788544. 
dax_functions_mathematical_trigonometric.htm
Advertisements