You have a Power BI model that contains the following two tables:
- Sales (Sales_ID, DateID, sales_amount)
- Date(DateID, Date, Month, Week, Year)
The tables have a relationship.
You need to create a measure to calculate the sales for same period from the previous year.
Which DAX formula should you use?
A. SUM(sales[sales_amount]) – CALCULATE(SUM(sales[sales_amount]), DATESYID(Date[Date]))
B. CALCULATE(SUM(sales[sales_amount]), SAMEPERIODLASTYEAR(Date[Date]))
C. SUM(sales[sales_amount]) – CALCULATE(SUM(sales[sales_amount]), SAMEPERIODLASTYEAR(Date[Date]))
D. CALCULATEx(SUM(sales(sales_amount]), DATESYID(Date[Date]))
References:
https://msdn.microsoft.com/en-us/library/ee634825.aspx
https://docs.microsoft.com/en-us/power-bi/desktop-quickstart-learn-dax-basics
https://msdn.microsoft.com/en-us/library/ee634972.aspx