SAMEPERIODLASTYEAR Function (DAX)

How does the SAMEPERIODLASTYEAR function (DAX) work?

The SAMEPERIODLASTYEAR function (DAX) 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 Formula Syntax

SAMEPERIODLASTYEAR(
     <dates>
)

How do you use the SAMEPERIODLASTYEAR function?

The SAMEPERIODLASTYEAR function can be used to declare that the values are moved one year back, based on “Date” column.

Related Blog Posts

Related Support Forum Posts

SamePeriodLastYear returns this year selecte period value
DATEADD vs SAMEPERIODLASTYEAR
Prior Year 12 Month Rolling

Considerations when using the SAMEPERIODLASTYEAR function

The dates argument can be any of the following:

  • A reference to a date/time column,
  • A table expression that returns a single column of date/time values,
  • A Boolean expression that defines a single-column table of date/time values.

Related Video Tutorials

Formula examples using the SAMEPERIODLASTYEAR function

=CALCULATE(SUM(ResellerSales_USD[SalesAmount_USD]), SAMEPERIODLASTYEAR(DateTime[DateKey]))

= CALCULATE(SUM(‘GA Traffic'[Users]),SAMEPERIODLASTYEAR(‘GA Traffic'[Date]), AllExcept(‘GA Traffic’, ‘GA Traffic'[Date]))

= CALCULATE ( SUM (Sales [Sales Amount]),SAMEPERIODLASTYEAR (Sales [Date]) )

Related DAX Functions

PREVIOUSYEAR

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI

DOWNLOAD

To access our comprehensive DAX formula reference guide just insert your email address below. The resource will download immediately and we’ll also email it to you.