Page 44 - DAX-Formula-Reference-Guide-Enterprise-DNA_Neat
P. 44

DAX Formulas Reference Guide  |  Math and Trig Functions (DAX)



                RANDBETWEEN Function (DAX)
                Returns a random number in the range between two numbers you specify.

                Syntax: RANDBETWEEN(<bottom>,<top>)



                Parameter                    Definition
                bottom                       The smallest integer the function will return.

                top                          The largest integer the function will return.



                Return Value:
                A whole number.

                Example:
                The following formula returns a random number between 1 and 10.

                =RANDBETWEEN(1,10)

                SUMX Function (DAX)

                Returns the sum of an expression evaluated for each row in a table.

                Syntax: SUMX(<table>,<expression>)


                Parameter                    Definition

                table                        The table containing the rows for which the expression will be evaluated.

                expression                   The expression to be evaluated for each row of the table.



                Example:
                The following example first filters the table, InternetSales, on the expression,
                ShippingTerritory10 = 5, and then returns the sum of all values in the column, Frieght. In
                other words, the expression returns the sum of freight charges for only the specified sales
                area.

                =SUMX(FILTER(InternetSales,InternetSales[SalesTerritoryID]=5),[Freight])

                If you do not need to filter the column, use the SUM function. The SUM function is similar
                to the Excel function of the same name, except it takes a column as a reference.




















                +64 21 164 5508  |  info@enterprisedna.co  44
   39   40   41   42   43   44   45   46   47   48   49