From the course: Mastering Business Intelligence with DAX, Power BI, and Excel by Microsoft Press

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Understand lesson 9 exercises: Table functions

Understand lesson 9 exercises: Table functions

- The first exercise from Lesson 9 is to create a measure that computes the average sales for the top 10 customers, where the top 10 is defined based on the largest sales. So we'll create a measure in the Other folder, and we'll just call it Average Sales Top 10 Customers. And we'll use a variable to define this top 10, just to split it in two parts, so Top10. We can use the TOPN function here, and we want to have the top 10 from the Customer table, so we'll use the Sales measure, and we'll use it in a descending order to get the top 10. Then we'll need to include the RETURN statement, and now we can just use the AVERAGEX function to calculate over this newly defined variable Top10. And we want to include the Sales for those top 10 customers. Like this. Note here that the Customer table is filtered within the current context. So if you add a filter on say a segment or a year, that is also taken into account…

Contents