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

DAX Formulas Reference Guide  |  Date and Time Functions (DAX)



                PREVIOUSMONTH Function (DAX)
                Returns a table that contains a column of all dates from the previous month, based on
                the first date in the dates column, in the current context.

                Syntax: PREVIOUSMONTH(<dates>)


                Parameter                    Definition

                dates                        A column that contains dates.


                Return Value:
                A table containing a single column of date values.

                =CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]), PREVIOUSMONTH(‘DateTime’[D
                ateKey]))


                PREVIOUSQUARTER Function (DAX)
                Returns the first date of the quarter in the current context for the specified column of
                dates.

                Syntax: STARTOFQUARTER(<dates>)


                Parameter                    Definition

                dates                        A column that contains dates.


                Return Value:
                A table containing a single column and single row with a date value.

                =STARTOFQUARTER(DateTime[DateKey])


                PREVIOUSYEAR Function (DAX)
                Returns a table that contains a column of all dates from the previous year, given the last
                date in the dates column, in the current context.

                Syntax: PREVIOUSYEAR(<dates>[,<year_end_date>])


                Parameter                    Definition

                dates                        A column that contains dates.

                year_end_date                A literal string with a date that defines the year-end date. The default is
                                             December 31st. (Optional)



                Return Value:
                A table containing a single column of date values.

                =CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]), PREVIOUSYEAR(‘DateTime’[Dat
                eKey]))



                +64 21 164 5508  |  info@enterprisedna.co  19
   14   15   16   17   18   19   20   21   22   23   24