17.1Preparing the table the measure calculates on

An average per customer or a number of big customers requires going through the customers, not the sales. You already know iterators, these functions like SUMX or AVERAGEX that go through a table, row by row. Their first argument decides what they go through.

17.1.1Choosing what to go through

AVERAGEX goes through the rows of a table, calculates a number for each one, then takes their average. The table you give it decides what it goes through, and therefore what the average represents.

In our data, AVERAGE( Sales[Amount] ) gives the average per sale, 141,667. For an average per customer, go through the customers:

Average Revenue per Customer = AVERAGEX( VALUES( Customers[Customer ID] ), [Revenue] )
Power BI accepts this DAX foryes, Measureyes, Calculated columnno, Calculated tableno, Virtual table
In plain words

“I want the average revenue, going customer by customer among the customers shown, calculating the revenue of each one, then taking the average.”

Table visual, The “Average Revenue per Customer” measure, by city
CityAverage Revenue per Customer
New York300,000
Chicago250,000
Toronto150,000
Total242,857

This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.

VALUES supplies the visible customers. AVERAGEX calculates the number of each one, then the average. New York has 3 customers for 900,000, that is 300,000 per customer.

The rest of this lesson is part of izyDAX Pro

You have just read the first section. The next one, its animations, the exercises and the summary are waiting for you with izyDAX Pro, in a single payment.