Article

DAX Language - SAMEPERIODLASTYEAR

DAX Language - SAMEPERIODLASTYEAR


A.Baddane | Posted on April 09, 21

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
Add to favorite
Categories
Recent Posts
Filter column based on a list in Power Query
A.Baddane | April 05, 23

Sometimes when you work within power query, you need to filt...Read More


Use HTML in Power BI - Part 2
A.Baddane | July 05, 22

In the first blog post about using HTML in Power BI Desktop,...Read More


Use HTML in Power BI
A.Baddane | Feb. 21, 22

In this blog post, I will show you how to use HTML to create...Read More


Covid-19 Report
A.Baddane | Nov. 23, 21

The COVID-19 pandemic, also known as the coronavirus pandemi...Read More