Counting products
A card visual, with no slicers or filters on the page, shows this measure.
Products Sold = DISTINCTCOUNT ( Sales[Product] )
What does the card show?
Reading about filter context is one thing. Predicting what a measure shows in a real visual is another, and it's the skill that actually fixes reports. Each exercise gives you a measure, a visual, and three answers. Pick one and see why it's right or wrong.
Free, no sign-up. Your progress is saved in this browser. Want to experiment instead? Try the interactive examples.
Every exercise runs against these tables, so you can check any answer by hand. Sales relates to Product on Product, and to a full 2025–2026 Date table on Date, with Year, Month (the month name), and Month Number columns. [Total Sales] is SUM ( Sales[Amount] ).
Sales
| Order | Date | Product | Region | Qty | Amount |
|---|---|---|---|---|---|
| 1 | 2025-01-15 | Widget | North | 2 | 200 |
| 2 | 2025-01-20 | Gadget | North | 1 | 150 |
| 3 | 2025-02-03 | Widget | South | 3 | 300 |
| 4 | 2025-02-18 | Gizmo | South | 1 | 50 |
| 5 | 2025-03-05 | Gadget | North | 2 | 300 |
| 6 | 2025-03-22 | Widget | South | 1 | 100 |
| 7 | 2026-01-10 | Widget | North | 4 | 400 |
| 8 | 2026-02-14 | Gizmo | North | 2 | 100 |
Product
| Product | Category | Price |
|---|---|---|
| Widget | Hardware | 100 |
| Gadget | Hardware | 150 |
| Gizmo | Accessories | 50 |
A card visual, with no slicers or filters on the page, shows this measure.
Products Sold = DISTINCTCOUNT ( Sales[Product] )
What does the card show?
A table visual has Sales[Region] on rows and this measure as a value. [Total Sales] is SUM ( Sales[Amount] ).
Avg Order = DIVIDE ( [Total Sales], COUNTROWS ( Sales ) )
What does the South row show?
Suppose Sales had no Amount column, only Qty, and the price lives on the Product table. Sales relates to Product on Product, many to one.
-- Target: a measure that returns 1,600 in a card with no filtersWhich measure returns the true revenue, 1,600?
A card visual with no filters shows this measure.
Big Orders = COUNTROWS ( FILTER ( Sales, Sales[Amount] > 200 ) )
What does the card show?
A card visual with no filters shows this measure.
Avg Qty = AVERAGE ( Sales[Qty] )
What does the card show?
A table visual has Sales[Region] on rows: North and South.
North Sales = CALCULATE ( [Total Sales], Sales[Region] = "North" )
What does the South row show?
Same table visual, Sales[Region] on rows. The filter is now wrapped in KEEPFILTERS.
North Sales = CALCULATE ( [Total Sales], KEEPFILTERS ( Sales[Region] = "North" ) )
What does the South row show now?
A table visual has Product[Product] on rows.
% of Total = DIVIDE ( [Total Sales], CALCULATE ( [Total Sales], ALL ( Product[Category] ) ) )
What does the Gizmo row show?
This is a calculated column added to the Product table, not a measure.
Product Sales = SUM ( Sales[Amount] )
What value does the Gizmo row of the Product table get?
A table visual has Product[Product] on rows.
Hardware Sales = CALCULATE ( [Total Sales], Product[Category] = "Hardware" )
What does the Gizmo row show?
A card visual with no filters. Both columns are in the Sales table.
North or Widget = CALCULATE ( [Total Sales], Sales[Region] = "North" || Sales[Product] = "Widget" )
What does the card show?
A table visual has Sales[Region] on rows. Product relates to Sales one-to-many, with the default single cross-filter direction.
Product Count = COUNTROWS ( Product )
What does the South row show?
A table visual has Product[Product] on rows. A slicer on Product[Product] has Widget and Gadget selected, so Gizmo isn't shown.
% of Selected = DIVIDE ( [Total Sales], CALCULATE ( [Total Sales], ALLSELECTED ( Product[Product] ) ) )
What does the Widget row show?
A card visual with no filters. The author wants the number of products with more than 400 in sales.
Big Products = COUNTROWS ( FILTER ( VALUES ( Product[Product] ), SUM ( Sales[Amount] ) > 400 ) )
What does the card show?
A card visual with no filters.
Sales by Product = SUMX ( Product, SUM ( Sales[Amount] ) )
What does the card show?
A table visual has Product[Product] on rows.
Sales Rank = RANKX ( Product, [Total Sales] )
What does the Gadget row show?
A card visual with no filters. 'Date'[Month] holds the month name (January, February, ...), with no year.
Best Month Sales = MAXX ( VALUES ( 'Date'[Month] ), [Total Sales] )
What does the card show?
A card visual with no filters.
Avg per Product = AVERAGEX ( VALUES ( Sales[Product] ), [Total Sales] )
What does the card show?
A matrix has 'Date'[Year] and 'Date'[Month] on rows. 'Date' is a full calendar table for 2025–2026, marked as a date table and related to Sales[Date].
Sales YTD = TOTALYTD ( [Total Sales], 'Date'[Date] )
What does the February 2025 row show?
Same matrix and the same Sales YTD measure. Look at the subtotal row for the year 2025.
Sales YTD = TOTALYTD ( [Total Sales], 'Date'[Date] )
What does the 2025 subtotal row show?
Same matrix. There are no sales at all in March 2026.
Sales LY = CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
What does the March 2026 row show for Sales LY?
A matrix has 'Date'[Year] and 'Date'[Month] on rows.
Sales PM = CALCULATE ( [Total Sales], DATEADD ( 'Date'[Date], -1, MONTH ) )
What does the January 2026 row show?
Same matrix, by Year and Month.
Sales YTD = TOTALYTD ( [Total Sales], 'Date'[Date] )
What does the January 2026 row show?
Same matrix. The data stops in February 2026. Look at the 2026 subtotal.
Sales LY = CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
What does the 2026 subtotal show for Sales LY?
This measure won't save. Power BI says a function has been used in a True/False expression used as a table filter expression.
Big Orders = CALCULATE ( COUNTROWS ( Sales ), [Total Sales] > 200 )
Which version counts orders over 200 correctly?
A card with no filters shows this measure. The author expected North's total.
North Sales = VAR Total = [Total Sales] RETURN CALCULATE ( Total, Sales[Region] = "North" )
What does the card show?
A card with no filters. The product is spelled "Widget" in the data, but the measure says "widget".
Widget Sales = CALCULATE ( [Total Sales], Product[Product] = "widget" )
What does the card show?
A table visual has Product[Product] and this measure. A slicer is set to 'Date'[Year] = 2026. The author expected only products with 2026 sales.
Status = IF ( [Total Sales] > 0, "Active", "None" )
How many rows does the table show?
A table visual has Product[Product] on rows, with a total row.
Revenue = SUM ( Sales[Qty] ) * SELECTEDVALUE ( Product[Price] )
What does the total row show?
A card visual with no filters. The author wants the number of days from the first sale to the last.
Days Selling = MAX ( Sales[Date] ) - MIN ( Sales[Date] )
What does the card show?
Studying for the exam? The PL-300 study guide maps every skill to a page and has scenario questions for each area. Got one wrong here? That's the point. Each answer links to the page that explains it. For the full picture, start with filter context and CALCULATE.