RAND Function (DAX)

How does the RAND function (DAX) work?

The RAND function (DAX) returns an evenly distributed random number greater than or equal to 0, and less than 1. Every time the cell containing that function is recalculated, the number returned changes.

RAND Formula Syntax


How do you use the RAND function?

Recalculation depends on different factors, including whether the workbook is set to Manual or Automatic recalculation mode, and whether the data has been refreshed. This is different from Microsoft Excel, where you can control by turning off recalculation, when RAND generates a new random number.

Related Blog Posts

Related Support Forum Posts

Understanding DAX Formula
Developing Complex Dax functions

Considerations when using the RAND function

RAND and other dynamic functions with no fixed values are not recalculated at all. For example, execution of a query or filtering will not usually cause re-evaluation of such functions. Moreover, when the entire column is recalculated, the results for those functions will be recalculated. Such circumstances involve updating from an external data source or manual data editing triggering re-evaluation of formulas containing certain functions.

In addition, RAND is always recalculated when the function is used to define a variable.

Furthermore, the RAND function can not return a result of zero in such contexts in order to avoid errors such as zero division.

Related Video Tutorials

Formula examples using the RAND function


=RAND () * 100

returns 51.2418613788544.


Related Course Modules