Streak 0 daysPoints 0

Lesson09/59
Iterating a column, not a table

Averages per customer with AVERAGEX over VALUES

New functionsAVERAGEX, VALUES
StatusNot started

AVERAGE(Sales[Unit Price]) averages order lines. Business questions usually ask for an average per something else: per customer, per day, per product. For that you iterate the distinct values of a column with VALUES, compute the measure for each one, and average the results.

VALUES(Customer[Customer]) returns the customers visible in the cell. Inside AVERAGEX, the measure [Sales Amount] runs once per customer, and context transition turns that customer into a filter. Customers who bought nothing return BLANK, and AVERAGEX skips BLANK.

Your task

Write a measure named Sales per Customer that returns the average Sales Amount per customer who bought something in the cell.

*1*1*1*1SALEST1 · 420 ROWSSalesKeyNUMOrder DateDATEShip DateDATEProductKeyNUMCustomerKeyNUMQuantityNUMUnit PriceNUMPRODUCTT2 · 8 ROWSProductKeyNUMProductTEXTCategoryTEXTColorTEXTList PriceNUMStandard CostNUMCUSTOMERT3 · 10 ROWSCustomerKeyNUMCustomerTEXTCountryTEXTSegmentTEXTDATET4 · 731 ROWSDateDATEYearNUMQuarterTEXTMonthTEXTMonth NumberNUMNOTES1Filters flow from 1 to *, alongthe arrow: Product filters Sales.2Select a column or a measureto insert it at the cursor.3Measures in this model:[Sales Amount][Total Cost]Key columnFact tableSALES MODEL · STAR SCHEMASHEET 1 OF 1

About this exercise

You practise iterating a column, not a table with AVERAGEX and VALUES. The exercise runs on a small bike-shop model with a Sales fact table and Product, Customer and Date dimensions, the same star schema in every lesson.

Your measure, Sales per Customer, fills a Power BI-style matrix grouped by Product[Category] and Date[Year]. As in a real report, each cell evaluates the measure in its own filter context, and the subtotals and the grand total are evaluated again in theirs rather than added up. When you check your answer, every cell is compared with the expected value, wrong cells are marked, and the hint is about the mistake you made.

Measures that already exist in the model: Sales Amount and Total Cost. Reference them in square brackets, for example [Sales Amount].

Where you start

Sales per Customer =

The result to build

Expected result for Sales per Customer
Year
Category20242025Total
Accessories1,561.681,501.753,063.43
Bikes12,795.5611,915.7220,960.60
Clothing1,248.721,122.382,246.39
Total14,184.2412,973.6325,739.45

Last updated 10 November 2026

Opening the exercise…