Power BI Time Intelligence Functions
Power BI Time Intelligence Functions
Power BI
Time Intelligence
Functions
ANKIT YADAV
@ankityadav.info
1.TOTALYTD()
Evaluates the year-to-date value of the
expression in the current context.
=TOTALYTD(<expression>,<dates>[,<filter>][,<year_end_date>])
Example
= TOTALYTD(
SUM(InternetSales_USD[SalesAmou
nt_USD]),
DateTime[DateKey],
ALL('DateTime'), "6/30")
2.TOTALQTD()
Evaluates the value of the expression for the dates
in the quarter to date, in the current context.
=TOTALQTD(<expression>,<dates>[,<filter>])
Example
= TOTALQTD(
SUM(InternetSales_USD[SalesAmou
nt_USD]),
DateTime[DateKey])
3.DATEADD()
Returns a table that contains a column of dates,
shifted either forward or backward in time by the
specified number of intervals from the dates in the
current context.
=DATEADD(<dates>,<number_of_intervals>,<interval>)
Example
= DATEADD(
DateTime[DateKey],
-1,year)
4.ENDOFMONTH()
Returns the last date of the month in the current
context for the specified column of dates.
= ENDOFMONTH(<dates>)
Example
= ENDOFMONTH(DateTime[DateKey])
5.LASTDATE()
Returns the last date in the current context for
the specified column of dates.
= LASTDATE( <dates> )
Example
= LASTDATE(
'InternetSales_USD'[SaleDateKey
] )
6.PREVIOUSDAY()
Returns a table that contains a column of all
dates representing the day that is previous to
the first date in the dates column, in the current
context.
= PREVIOUSDAY( <dates> )
Example
= CALCULATE(
SUM(InternetSales_USD[SalesAmou
nt_USD]),
PREVIOUSDAY('DateTime'[DateKey]
))
7.SAMEPERIODLASTYEAR()
Returns a table that contains a column of dates
shifted one year back in time from the dates in
the specified dates column, in the current
context.
= SAMEPERIODLASTYEAR( <dates> )
Example
= CALCULATE(
SUM(InternetSales_USD[SalesAmou
nt_USD]),
SAMEPERIODLASTYEAR('DateTime'[D
ateKey]))
8.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 number of intervals either
forward in time or back in time.
= PARALLELPERIOD(<dates>,<number_of_intervals>,<interval>)
Example
= CALCULATE(
SUM(InternetSales_USD[SalesAmount
_USD]),
PARALLELPERIOD(
DateTime[DateKey],-1,year))
9.DATESINPERIOD()
Returns a table that contains a column of
dates that begins with a specified start date
and continues for the specified number and
type of date intervals.
= DATESINPERIOD( <dates> , <start_date> ,
<number_of_intervals> , <interval>)
Example
= CALCULATE(SUM(Sales[Sales Amount]),
DATESINPERIOD(
'Date'[Date],
MAX('Date'[Date]),
-1,
YEAR ))