nerdexam
Microsoft

PL-300 · Question #271

You have the Power BI data model shown in the following exhibit. The Sales table contains records of sales by day from the last five years up until today's date. You plan to create a measure to…

The correct answer is C. Calculate (SUM(Sales[Sales]), SAMEPERIODLASTYEAR(dimDate[Date] )). To return the total sales of March 2021 when March 2022 is selected, you must use a DAX expression that shifts the date context to the equivalent period in the previous year. The SAMEPERIODLASTYEAR function within CALCULATE correctly achieves this time intelligence shift.

Submitted by manish99· Apr 18, 2026

Question

You have the Power BI data model shown in the following exhibit. The Sales table contains records of sales by day from the last five years up until today’s date. You plan to create a measure to return the total sales of March 2021 when March 2022 is selected. Which DAX expression should you use?

Exhibit

PL-300 question #271 exhibit

Options

  • ACalculate (Sum(Sales[Sales]), PREVIOUSYEAR( dimDate[Date])
  • BTOTALYTD (SUM(Sales[Sales]), dimDate[Date] )
  • CCalculate (SUM(Sales[Sales]), SAMEPERIODLASTYEAR(dimDate[Date] ))
  • DSUM(Sales[Sales])

How the community answered

(22 responses)
  • A
    9% (2)
  • B
    5% (1)
  • C
    86% (19)

Why each option

To return the total sales of March 2021 when March 2022 is selected, you must use a DAX expression that shifts the date context to the equivalent period in the previous year. The `SAMEPERIODLASTYEAR` function within `CALCULATE` correctly achieves this time intelligence shift.

ACalculate (Sum(Sales[Sales]), PREVIOUSYEAR( dimDate[Date])

The `PREVIOUSYEAR` function returns all dates for the *entire* previous year (e.g., all of 2021) based on the current context, rather than the specific corresponding period (e.g., only March 2021).

BTOTALYTD (SUM(Sales[Sales]), dimDate[Date] )

The `TOTALYTD` function calculates the year-to-date total for the current filter context, which is not the requirement of retrieving sales for a specific prior month.

CCalculate (SUM(Sales[Sales]), SAMEPERIODLASTYEAR(dimDate[Date] ))Correct

The `SAMEPERIODLASTYEAR` DAX function is specifically designed to shift the current date filter context back by one year while preserving the month and day context. When `March 2022` is selected, `SAMEPERIODLASTYEAR(dimDate[Date])` returns a table of dates for `March 2021`, enabling `CALCULATE(SUM(Sales[Sales]), ...)` to correctly sum sales for that precise prior period.

DSUM(Sales[Sales])

`SUM(Sales[Sales])` alone would only return the sum of sales for the currently selected period (March 2022) without any time intelligence function to shift the context to the previous year.

Concept tested: DAX time intelligence with SAMEPERIODLASTYEAR

Source: https://learn.microsoft.com/en-us/dax/sameperiodlastyear-function-dax

Community Discussion

No community discussion yet for this question.

Full PL-300 Practice