Time Intelligence
Functions In DAX
❖ DAX includes time-intelligence functions that enable
you to manipulate data using time periods, including
days, months, quarters, and years, and then build and
compare calculations over those periods.
❖ Before using any time-intelligence functions, make
sure to mark one of the tables containing date column
as Date Table.
Time Intelligence
Functions
TOTALYTD
DATEADD
SAMEPERIODLASTYEAR
PARALLELPERIOD
PREVIOUSYEAR
➢ These functions are used for
DATEMTD
analyzing and comparing data
over time periods. DATESINPERIOD
LASTDATE
STARTOFMONTH
ENDOFYEAR
Naveen Billa
➢ TOTALYTD: Calculates a measure for a given time period,
considering the total year-to-date.
Similarly, for QTD,MTD.
TOTALYTD(SUM(financials[Sales]), ‘Calendar'[Date])
TOTALQTD(SUM(financials[Sales]), ‘Calendar'[Date])
TOTALMTD(SUM(financials[Sales]), ‘Calendar'[Date])
➢ DATESYTD: Returns a table that contains a column of the
dates for the year to date, in the current context.
Similarly, for QTD,MTD.
CALCULATE(SUM(financials[Profit]),
DATESYTD('Calendar'[Date]))
CALCULATE(SUM(financials[Profit]),
DATESQTD('Calendar'[Date]))
CALCULATE(SUM(financials[Profit]),
DATESMTD('Calendar'[Date]))
Naveen Billa
➢ DATEADD: Adds or subtracts a specified number of units
from a date.
CALCULATE(SUM(financials[Sales]),
DATEADD('Calendar'[Date],-7,DAY))
➢ PARALLELPERIOD: Returns a table that contains a column
of dates that represents a period parallel to the dates in the
specified dates column, in the current context, with the
dates shifted a few intervals either forward in time or back
in time.
CALCULATE(SUM(financials[Sales]),
PARALLELPERIOD('Calendar'[Date],-2,MONTH))
Naveen Billa
➢ PREVIOUSYEAR : Returns a table that contains a column of all
dates from the previous year, given the last date in the date's
column, in the current context. Similarly, for QTR & Month.
CALCULATE(SUM(financials[Sales]),
PREVIOUSYEAR(('Calendar'[Date])))
CALCULATE(SUM(financials[Sales]),
PREVIOUSQUARTER(('Calendar'[Date])))
CALCULATE(SUM(financials[Sales]),
PREVIOUSMONTH(('Calendar'[Date])))
➢ SAMEPERIODLASTYEAR: Retrieves data for the same period
in the previous year.
CALCULATE(SUM(financials[Sales]),
SAMEPERIODLASTYEAR(('Calendar'[Date])))
Naveen Billa