Counting Product Categories Sold Using DAX CALCULATE
HOTSPOT
You have the Power BI data model shown in the following exhibit.
You need to create a measure to count the number of product categories that had products sold during a selected period.
How should you complete the DAX expression? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.

Community Insight
The test is whether you combine DISTINCTCOUNT on Product[ProductCategory] with a CALCULATE filter argument of the 'Sales' table — the trap is picking COUNT (which double-counts) or filtering on the Date table, which cannot express 'had products sold'.
This PL-300 hotspot asks for a DAX measure that counts how many distinct product categories had products sold in a selected period. The correct expression is CALCULATE(DISTINCTCOUNT('Product'[ProductCategory]), 'Sales'), because DISTINCTCOUNT avoids double-counting repeated category rows and filtering by the Sales table removes categories with no transactions.
Choosing COUNT or filtering CALCULATE with the Date table. COUNT tallies every sales row, inflating the total far beyond the number of categories, and a Date-table filter returns all categories regardless of whether anything was actually sold, since the Date table has no relationship to sales activity.
Community Discussion (71 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
The measure must return the number of product categories, so the base expression is DISTINCTCOUNT('Product'[ProductCategory]) — ProductCategory repeats for every product in a category, so only DISTINCTCOUNT gives each category a single count. Wrapping it in CALCULATE with 'Sales' as the filter argument applies the active filter context (such as a Date slicer) to the transactions, so a category only appears in the count if rows for it exist in Sales during the selected period. This matches the requirement's two halves: "number of product categories" maps to DISTINCTCOUNT on the category column, and "had products sold" maps to filtering on Sales.Why Other Candidate Answers Are Wrong
A plain COUNT of ProductCategory counts one row per sales transaction, so a category with 500 sold items is counted 500 times and the result is not a category count at all. Filtering CALCULATE with the Date table is also wrong because the Date table contains no information about which products were sold; as one commenter demonstrated, the result stays the same no matter which dates the slicer selects. DISTINCTCOUNT also cannot be built on the Sales table alone if only the category column is available, since the category lives in Product and must be reached through the model relationship.Community Comment Notes
Sushvij's answer of DISTINCTcount on 'Product'[product category] with 'Sales' was independently verified: ben_g_smith reported "Tested today by building a replica model and Sushvij is correct." Flaty noted that "in the product Table the ProductCategory is listed several rows" and that using "Date" is not possible as the filter. MrWood47 and odyash both express the same verdict, CALCULATE(DISTINCTCOUNT('Product'[ProductCategory]), 'Sales'), while cokimon raised the fair objection, "If you don't specify [date], how can you count how many sold for a specified period?" — the answer is that the Date slicer's filter context already flows into CALCULATE automatically.Official Reference
Exam Strategy
On hotspot DAX items, read the requirement for two separate clues: the aggregation target ("number of product categories" → DISTINCTCOUNT on the category column) and the filter source ("had products sold" → the transaction table, not the date table). Remember that slicer filter context from the Date table reaches CALCULATE automatically, so you rarely need Date as an explicit filter argument.
Frequently Asked Questions
Why filter CALCULATE with the Sales table instead of the Date table for this measure?
The Sales table is what identifies categories that actually had products sold. A Date-table filter only carries calendar rows, so every category would be counted regardless of sales activity.
Why use DISTINCTCOUNT instead of COUNT for Product[ProductCategory]?
ProductCategory repeats once per product, so COUNT would return a transaction-level total rather than a category count. DISTINCTCOUNT returns each category only once.
Related Analysis
Practice All PL-300 Questions
Access 116 questions with complete answers and detailed explanations.
View Full PL-300 Practice Test →