nerdexam
Microsoft

PL-300 · Question #63

You have a Power BI model for sales data. You create a measure to calculate the year-to-date sales. You need to compare the year-to-date sales with the previous year for the same time period. Which…

The correct answer is C. SAMEPERIODLASTYEAR. To compare year-to-date sales with the same time period in the previous year, the DAX function SAMEPERIODLASTYEAR should be used.

Submitted by emma.c· Apr 18, 2026Model the data

Question

You have a Power BI model for sales data. You create a measure to calculate the year-to-date sales. You need to compare the year-to-date sales with the previous year for the same time period. Which DAX function should you use?

Options

  • ALASTDATE
  • BTOTALYTD
  • CSAMEPERIODLASTYEAR
  • DPREVIOUSYEAR

How the community answered

(41 responses)
  • A
    17% (7)
  • B
    7% (3)
  • C
    71% (29)
  • D
    5% (2)

Why each option

To compare year-to-date sales with the same time period in the previous year, the DAX function SAMEPERIODLASTYEAR should be used.

ALASTDATE

LASTDATE returns the last date in the current filter context, which is not suitable for comparing periods across years.

BTOTALYTD

TOTALYTD calculates the year-to-date total for the current year but does not provide a mechanism to directly compare it to a previous year's equivalent period without further functions.

CSAMEPERIODLASTYEARCorrect

The SAMEPERIODLASTYEAR DAX function calculates a set of dates that are one year prior to the dates in the current filter context, preserving the day and month. This precisely enables comparing a current year-to-date period with the equivalent period from the previous year.

DPREVIOUSYEAR

PREVIOUSYEAR returns all dates of the prior year, not specifically the same period or duration as the current filter context, making it less precise for a 'same period last year' comparison than SAMEPERIODLASTYEAR.

Concept tested: DAX time intelligence (SAMEPERIODLASTYEAR)

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

Topics

#DAX#Time Intelligence#Measures#Previous Year Comparison

Community Discussion

No community discussion yet for this question.

Full PL-300 Practice