Courseiva

Understanding a DAX Measure for Previous Year Sales in Power BI

Exhibit

Refer to the exhibit.

```
Measure = 
VAR SelectedYear = SELECTEDVALUE('Date'[Year])
RETURN
CALCULATE(
    SUM(Sales[Amount]),
    'Date'[Year] = SelectedYear - 1
)
```

Refer to the exhibit. You see a Power BI DAX measure. What does this measure calculate?

Quick Answer

The answer is total sales for the previous year relative to the selected year. This measure is correct because the `SAMEPERIODLASTYEAR` function shifts the current filter context back by exactly one year, so when a user selects a specific year in a slicer or axis, the measure automatically returns the corresponding sales from the prior year. On the Microsoft Power Platform Fundamentals PL-900 exam, this tests your understanding of time intelligence functions in DAX, often appearing in a scenario where you must identify year-over-year comparison logic. A common trap is confusing `SAMEPERIODLASTYEAR` with `PREVIOUSYEAR`, but remember that `SAMEPERIODLASTYEAR` preserves the exact date range (e.g., full quarter or month), while `PREVIOUSYEAR` always returns the entire prior calendar year. For a quick memory tip, think “Same period, last year” — the function name itself tells you it mirrors the current period’s boundaries but one year back.

⚠ Common exam trap

Watch out — candidates often confuse `SAMEPERIODLASTYEAR` with a year-over-year growth percentage calculation, but the measure only returns the absolute value from the previous year, not the growth rate.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Total sales for the previous year relative to the selected year.

The DAX measure uses the `SAMEPERIODLASTYEAR` function, which shifts the current filter context back by one year. When placed in a visual with a year slicer or axis, it returns the total sales for the same period in the previous year relative to the selected year. This is a standard time intelligence calculation for comparing year-over-year absolute values.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    Total sales for the previous year relative to the selected year.

    Why this is correct

    The measure uses time intelligence, shifting the selected filter context back one year via SAMEPERIODLASTYEAR or DATEADD, so it returns prior-year sales for the chosen period. That matches calculating total sales for the previous year relative to the selected year.

  • ✗

    Total sales for the current year.

    Why it's wrong here

    A measure returning current-year sales would filter the date table with YEAR or DATESYTD; the exhibit's expression aggregates a different column or time context, so its result diverges from that figure. It is tempting because year-to-date totals are a common DAX pattern, and such a measure would be right if the formula actually applied a current-year filter.

  • ✗

    Running total of sales up to the selected year.

    Why it's wrong here

    The measure aggregates sales across the entire year context rather than accumulating from the start of the period to the selected year, so it returns an annual total, not a running total. Running totals are tempting because cumulative patterns are common in DAX, but they require FILTER with ALLSELECTED or similar.

  • ✗

    Year-over-year growth percentage.

    Why it's wrong here

    The measure sums sales for the current year context without comparing against a prior-year baseline, so no growth ratio is produced. Year-over-year growth is tempting because it is a frequent DAX pattern, but it requires SAMEPERIODLASTYEAR or DATEADD plus a division to compute the percentage change.

About these practice questions

One of 701 original PL-900 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way this is tested on PL-900

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A Power BI report uses the KQL query shown. What is the purpose of this query?

medium
  • A.To list all sales transactions for North America
  • ✓ B.To show total sales per product category for North America in descending order
  • C.To calculate average sales amount by region
  • D.To filter sales data by product category

Why B: The KQL query uses the `summarize` operator to group sales data by `ProductCategory` and calculate the total sales amount using `sum(SalesAmount)`. The `where` clause filters for `Region == 'North America'`, and `order by` sorts the aggregated results in descending order. This produces a list of product categories with their total sales for North America, sorted from highest to lowest.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PL-900 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PL-900 exam.