Forum Discussion

MatthewCunliffe's avatar
MatthewCunliffe
New Member
3 years ago
Solved

SamesPeriodLastYear vs Using Var + Return

Hi there!

I've recently completed a finance-oriented course on DAX and Power Pivot/BI. 

When calculating sales growth in dollar $ terms the instructor offered 2 different solutions, but with a different outcome:

Measure 1SalesPY:=CALCULATE([Sales],SAMEPERIODLASTYEAR(Dim_Dates[Date]))

Measure 2: 

Sales$Growth:=var PYSales = CALCULATE([Sales],SAMEPERIODLASTYEAR(Dim_Dates[Date]))

return [Sales] - PYSales

 

The outcome is different one from the other. 
Thanks in advance!

  • Hi MatthewCunliffe 

    Because they are two different calculations. The 2nd measure returns the difference between the current year and the previous year which is clearly indicated by the measure name.

1 Reply

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi MatthewCunliffe 

    Because they are two different calculations. The 2nd measure returns the difference between the current year and the previous year which is clearly indicated by the measure name.