Distinct counts and averages
Different denominators answer different questions
A sales line is not an order. O01 occurs on two rows. Counting all five rows answers how many lines were recorded; counting distinct nonmissing order identifiers answers how many orders appear in the selection. Distinct counts are recalculated for each grouping, not generally added across groups. Use the V007 clean Import model from labs/relationships/README.md: FactSales, DimProduct and DimRegion, active single-direction one-to-many relationships. Currency is USD, one row per order line, Jan 5–7 2026. Clear unrelated filters. Formula snippets are individual New measure definitions, not a DAX query or a single multi-measure script. Use comma argument separators and decimal points (English teaching syntax); local separator settings may differ. All outputs are predicted, native DAX NOT RUN. Create Total Revenue and Sales Lines from the previous lesson first.
Choose the aggregation by meaning
DISTINCTCOUNT takes one column and includes BLANK as a distinct value when present; an empty selection returns BLANK. Validate identifiers rather than letting a blank order count as a real order. DISTINCTCOUNTNOBLANK is an alternative when a documented missing-key policy excludes blanks. AVERAGE calculates the arithmetic mean of numeric values in a column, ignoring blanks but including zero. MIN and MAX over a numeric column give its smallest and largest selected values. These are column aggregates, not automatic weighted calculations.
Example 1: count orders and explain totals
Orders = DISTINCTCOUNT(FactSales[OrderID])All four orders O01–O04 appear. Notebook has O01 and O02 (2), Desk Lamp has O01 and O04 (2), Backpack has O03 (1). Product-level counts sum to 5 but the grand total is 4 because O01 appears in two product groups. Do not replace the total with the sum of displayed counts. The total evaluates the measure without the individual product filter.
Example 2: distinguish mean line revenue and price
Average Line Revenue = AVERAGE(FactSales[RevenueUSD])Lowest Line Revenue = MIN(FactSales[RevenueUSD])Highest Line Revenue = MAX(FactSales[RevenueUSD])For all five lines the mean is 40 USD, minimum 24 and maximum 60. North mean is 104/3 = 34.6667 USD (displayed to two decimals as 34.67); South mean is 48. An unweighted average of the two region means is about 41.33, not 40. Average unit price over lines is (12+30+12+50+30)/5 = 26.8, but revenue per unit is 200/9 ≈ 22.22; they weight transactions differently. Average order revenue is 200/4 = 50 and needs its own denominator.
Check the total, not only individual cells
The denominator should come from the question: order count, line count or units. Do not average already rounded visual values, assume distinct counts are additive, or treat a missing amount as zero without a policy. When orders span multiple products, a product-filtered order revenue average includes only that product’s lines, not the entire basket value.
Practice
Complete task 3 of the worksheet. Compute distinct order counts by product and the overall count; calculate North average line revenue and explain the total.