Case 5: ABC analysis of customers
Not every customer needs the same attention. You give every customer its sales as a column and put it into class A, B or C, so the dashboard and slicers can filter by it.
In short: in the Customer table, SUMX(RELATEDTABLE(Orders), Orders[Amount]) calculates every customer's sales as a calculated column. A second column SWITCH(TRUE(), Customer[Customer Sales] >= 90000, "A", Customer[Customer Sales] >= 30000, "B", "C") assigns the class.
Task 1: sales per customer as a column
Task For the ABC classes every customer needs their sales as a fixed column. Create the calculated column "Customer Sales" in Customer: the sum of Orders[Amount] across all of the customer's orders.
Orders 221 rows, 5 columns
| OrderID | Date | CustomerID | RepID | Amount |
|---|---|---|---|---|
| 1001 | 4 Jan 2025 | 105 | 3 | 2850 |
| 1002 | 16 Jan 2025 | 101 | 1 | 8730 |
| 1003 | 19 Jan 2025 | 105 | 4 | 4650 |
| 1004 | 1 Feb 2025 | 103 | 2 | 5210 |
| 1005 | 11 Feb 2025 | 109 | 5 | 11440 |
| 1006 | 11 Feb 2025 | 111 | 6 | 2000 |
| 1007 | 11 Feb 2025 | 113 | 2 | 3850 |
| 1008 | 12 Feb 2025 | 103 | 2 | 5670 |
| 1009 | 13 Feb 2025 | 104 | 2 | 7380 |
| 1010 | 13 Feb 2025 | 109 | 5 | 8250 |
| 1011 | 16 Feb 2025 | 101 | 1 | 7650 |
| 1012 | 21 Feb 2025 | 101 | 2 | 6750 |
Showing the first 12 of 221 rows.
Measures: [Total Sales]
Customer 16 rows, 3 columns
| CustomerID | Customer | Industry |
|---|---|---|
| 101 | Berg Engineering Ltd | Manufacturing |
| 102 | Northlight Trading Co | Retail |
| 103 | Harbor Logistics Inc | Services |
| 104 | Crane Electric plc | Manufacturing |
| 105 | Sunfield Markets LLC | Retail |
| 106 | Alpine Tools Ltd | Manufacturing |
| 107 | Riverside Consulting LLC | Services |
| 108 | Lakeside Print Co | Services |
| 109 | Rhine Steel Inc | Manufacturing |
| 110 | West End Fashion Ltd | Retail |
| 111 | Valley Wine Merchants LLC | Retail |
| 112 | Midland Services Ltd | Services |
Showing the first 12 of 16 rows.
SalesRep 6 rows, 3 columns
| RepID | Name | Region |
|---|---|---|
| 1 | Emma Clarke | North |
| 2 | Tom Wolf | North |
| 3 | Ravi Patel | South |
| 4 | Lucy Evans | South |
| 5 | Sam Kerr | West |
| 6 | Mia Lang | West |
Target 144 rows, 3 columns
| Date | RepID | TargetAmount |
|---|---|---|
| 1 Jan 2025 | 1 | 7500 |
| 1 Feb 2025 | 1 | 7500 |
| 1 Mar 2025 | 1 | 7500 |
| 1 Apr 2025 | 1 | 7500 |
| 1 May 2025 | 1 | 9000 |
| 1 Jun 2025 | 1 | 9500 |
| 1 Jul 2025 | 1 | 9500 |
| 1 Aug 2025 | 1 | 7500 |
| 1 Sep 2025 | 1 | 7500 |
| 1 Oct 2025 | 1 | 9000 |
| 1 Nov 2025 | 1 | 9500 |
| 1 Dec 2025 | 1 | 9000 |
Showing the first 12 of 144 rows.
Measures: [Total Target]
Date 730 rows, 4 columns
| Date | Year | Month | MonthName |
|---|---|---|---|
| 1 Jan 2025 | 2025 | 1 | Jan |
| 2 Jan 2025 | 2025 | 1 | Jan |
| 3 Jan 2025 | 2025 | 1 | Jan |
| 4 Jan 2025 | 2025 | 1 | Jan |
| 5 Jan 2025 | 2025 | 1 | Jan |
| 6 Jan 2025 | 2025 | 1 | Jan |
| 7 Jan 2025 | 2025 | 1 | Jan |
| 8 Jan 2025 | 2025 | 1 | Jan |
| 9 Jan 2025 | 2025 | 1 | Jan |
| 10 Jan 2025 | 2025 | 1 | Jan |
| 11 Jan 2025 | 2025 | 1 | Jan |
| 12 Jan 2025 | 2025 | 1 | Jan |
Showing the first 12 of 730 rows.
RELATEDTABLE goes from the one side to the many side of a relationship, as in the lesson on RELATED and LOOKUPVALUE. The lesson calculated column or measure? explains why a column is right here: a class should work as a row and as a slicer.
Task 2: the class
Task Put the customers into classes. Create the calculated column "Class" in Customer: "A" from 90,000 customer sales, "B" from 30,000, otherwise "C".
Orders 221 rows, 5 columns
| OrderID | Date | CustomerID | RepID | Amount |
|---|---|---|---|---|
| 1001 | 4 Jan 2025 | 105 | 3 | 2850 |
| 1002 | 16 Jan 2025 | 101 | 1 | 8730 |
| 1003 | 19 Jan 2025 | 105 | 4 | 4650 |
| 1004 | 1 Feb 2025 | 103 | 2 | 5210 |
| 1005 | 11 Feb 2025 | 109 | 5 | 11440 |
| 1006 | 11 Feb 2025 | 111 | 6 | 2000 |
| 1007 | 11 Feb 2025 | 113 | 2 | 3850 |
| 1008 | 12 Feb 2025 | 103 | 2 | 5670 |
| 1009 | 13 Feb 2025 | 104 | 2 | 7380 |
| 1010 | 13 Feb 2025 | 109 | 5 | 8250 |
| 1011 | 16 Feb 2025 | 101 | 1 | 7650 |
| 1012 | 21 Feb 2025 | 101 | 2 | 6750 |
Showing the first 12 of 221 rows.
Measures: [Total Sales]
Customer 16 rows, 4 columns
| CustomerID | Customer | Industry | Customer Sales |
|---|---|---|---|
| 101 | Berg Engineering Ltd | Manufacturing | 199620 |
| 102 | Northlight Trading Co | Retail | 29330 |
| 103 | Harbor Logistics Inc | Services | 72580 |
| 104 | Crane Electric plc | Manufacturing | 97800 |
| 105 | Sunfield Markets LLC | Retail | 94580 |
| 106 | Alpine Tools Ltd | Manufacturing | 136310 |
| 107 | Riverside Consulting LLC | Services | 26710 |
| 108 | Lakeside Print Co | Services | 20940 |
| 109 | Rhine Steel Inc | Manufacturing | 195580 |
| 110 | West End Fashion Ltd | Retail | 26560 |
| 111 | Valley Wine Merchants LLC | Retail | 12760 |
| 112 | Midland Services Ltd | Services | 51440 |
Showing the first 12 of 16 rows.
SalesRep 6 rows, 3 columns
| RepID | Name | Region |
|---|---|---|
| 1 | Emma Clarke | North |
| 2 | Tom Wolf | North |
| 3 | Ravi Patel | South |
| 4 | Lucy Evans | South |
| 5 | Sam Kerr | West |
| 6 | Mia Lang | West |
Target 144 rows, 3 columns
| Date | RepID | TargetAmount |
|---|---|---|
| 1 Jan 2025 | 1 | 7500 |
| 1 Feb 2025 | 1 | 7500 |
| 1 Mar 2025 | 1 | 7500 |
| 1 Apr 2025 | 1 | 7500 |
| 1 May 2025 | 1 | 9000 |
| 1 Jun 2025 | 1 | 9500 |
| 1 Jul 2025 | 1 | 9500 |
| 1 Aug 2025 | 1 | 7500 |
| 1 Sep 2025 | 1 | 7500 |
| 1 Oct 2025 | 1 | 9000 |
| 1 Nov 2025 | 1 | 9500 |
| 1 Dec 2025 | 1 | 9000 |
Showing the first 12 of 144 rows.
Measures: [Total Target]
Date 730 rows, 4 columns
| Date | Year | Month | MonthName |
|---|---|---|---|
| 1 Jan 2025 | 2025 | 1 | Jan |
| 2 Jan 2025 | 2025 | 1 | Jan |
| 3 Jan 2025 | 2025 | 1 | Jan |
| 4 Jan 2025 | 2025 | 1 | Jan |
| 5 Jan 2025 | 2025 | 1 | Jan |
| 6 Jan 2025 | 2025 | 1 | Jan |
| 7 Jan 2025 | 2025 | 1 | Jan |
| 8 Jan 2025 | 2025 | 1 | Jan |
| 9 Jan 2025 | 2025 | 1 | Jan |
| 10 Jan 2025 | 2025 | 1 | Jan |
| 11 Jan 2025 | 2025 | 1 | Jan |
| 12 Jan 2025 | 2025 | 1 | Jan |
Showing the first 12 of 730 rows.
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
The limits of 90,000 and 30,000 apply to sales across both years. SWITCH checks the highest limit first; otherwise every A customer would already stop at "B".
Common mistakes
A plain SUM in the column
SUM(Orders[Amount]) in a calculated column of Customer gives the sales of all customers in every row, because without CALCULATE or RELATEDTABLE the row does not become a filter.
Column in the wrong table
In Orders every row is an order, not a customer. The class belongs in the Customer table.
In real Power BI
- Calculated columns are calculated when the data refreshes. The class therefore only changes after the next refresh, not with a slicer.
- The classic ABC analysis by share of sales (A up to 80% of sales) needs a running total across the customers sorted by sales. Fixed limits keep it simpler and easy for the field team to follow.
- You build the same analysis with formulas in the Excel case ABC analysis.
Check your result
- Task 1: Berg Engineering Ltd has customer sales of 199,620, Cornerstone Catering Ltd 5,290.
- Task 2: Five customers are A (down to Sunfield Markets LLC at 94,580), four are B (Harbor Logistics, Brightpath Software, Midland Services, Eastbridge Construction), seven are C.
Back to case 4 or the course overview.