0% found this document useful (0 votes)
235 views10 pages

Power BI Time Intelligence Functions

The document describes 9 time intelligence functions in Power BI: TOTALYTD(), TOTALQTD(), DATEADD(), ENDOFMONTH(), LASTDATE(), PREVIOUSDAY(), SAMEPERIODLASTYEAR(), PARALLELPERIOD(), and DATESINPERIOD(). Each function is explained along with an example of how it can be used in DAX to analyze data over time periods like years, quarters, months and dates. The functions allow users to easily calculate time-based metrics and compare values across different time periods in their Power BI reports and analyses.

Uploaded by

Ankit Yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
235 views10 pages

Power BI Time Intelligence Functions

The document describes 9 time intelligence functions in Power BI: TOTALYTD(), TOTALQTD(), DATEADD(), ENDOFMONTH(), LASTDATE(), PREVIOUSDAY(), SAMEPERIODLASTYEAR(), PARALLELPERIOD(), and DATESINPERIOD(). Each function is explained along with an example of how it can be used in DAX to analyze data over time periods like years, quarters, months and dates. The functions allow users to easily calculate time-based metrics and compare values across different time periods in their Power BI reports and analyses.

Uploaded by

Ankit Yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Swipe

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 ))

You might also like