In this video we’ll learn how to calculate the difference between this year and last year sales.
Start with creating the Total Sales measure:
Total Sales = SUM(Sales[SalesAmount])
Then calculate last year sales:
Sales LY = CALCULATE( [Total Sales],SAMEPERIODLASTYEAR( Dates[Date]))
After you have both measures, subtract one from another to find out the difference. To remove empty and repeating rows in the first year, use the IF function.
Difference = IF ( ISBLANK ([Total Sales PY]), BLANK(), [Total Sales] - [Total Sales PY])
Finally, calculate a percent difference:
% diff = IF( ISBLANK([Total Sales PY]), BLANK(), DIVIDE( ([Total Sales] - [Total Sales PY]), [Total Sales]))
#DAX #PowerBI
#Timeintelligence
Contoso DEMO dataset: https://www.microsoft.com/en-us/downl...