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
Correct: it calculates the sum for the year before the selected one.
- ✗
Total sales for the current year.
Why it's wrong here
It uses SelectedYear - 1, so it's previous year.
- ✗
Running total of sales up to the selected year.
Why it's wrong here
It's not a running total; it's a single year calculation.
- ✗
Year-over-year growth percentage.
Why it's wrong here
It returns a sum, not a percentage.
Go deeper
Related to this question
About these practice questions
One of 904 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 →
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.