Article

DAX Language - SAMEPERIODLASTYEAR


A-Badde | Posted on April 09, 20

SAMEPERIODLASTYEAR Function

 Description:

The SAMEPERIODLASTYEAR function returns a set of dates in the current selection shifted one year back in time.

 Return Value:

SAMEPERIODLASTYEAR returns a table with a single column of date values.

 Syntax:

SAMEPERIODLASTYEAR( <dates> )  
  • Description of the parameter:

 

PARAMETER

DESCRIPTION

dates

Column containing dates or a table expression that returns a single column of date/time values

 

 Example:

  We would like to display in our report, in addition to the sales amount of the selected year, the sales amount of the previous year.

Using the following formula, we can calculate the Sales Amount of the previous year.

PreviousYear SAmount = 
            CALCULATE(
                SUM(Sales[SalesAmount]), 
                SAMEPERIODLASTYEAR('Calendar'[Date])
                )

 

Related Video:

 


(0) Comments

There is no comment

Leave a Comment

Your email address will not be published. Required fields are marked *

Add to favorite
Categories
Recent Posts
DAX Language - CONTAINS Function
A-Badde | May 09, 20

The CONTAINS function returns a boolean value, TRUE if each ...Read More


DAX Language - RANKX Function
A-Badde | May 05, 20

The RANKX function returns a single integer value that repre...Read More


DAX Language - AND and OR Functions
A-Badde | April 10, 20

AND/OR functions check whether all arguments are TRUE or one...Read More


DAX Language - Variables in DAX
A-Badde | April 10, 20

Use Var keyword to store the result of an expression as a na...Read More