12.1Context transition
You now know the two contexts. The row context points to a row, the filter context to the visible rows. This lesson starts from a table and a visual that do not give the same result, then shows how CALCULATE moves from the first context to the second.
12.1.1Two ways to add a column
You want the revenue of each customer. Power BI offers you two paths.
The first goes through a table visual. You drag the Name column of the Customers table onto it, then the Amount column of the Sales table. Power BI adds up the amounts on its own, and names the column “Sum of Amount.”
| Name | Sum of Amount |
|---|---|
| Orvane | 450,000 |
| Kumora | 300,000 |
| Talvio | 150,000 |
| Ribelia | 250,000 |
| Movara | 250,000 |
| Northel | 200,000 |
| Sam Lee | 100,000 |
| Total | 1,700,000 |
This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.
Each customer gets their revenue. Orvane gets 450,000, Kumora 300,000.
The second goes through the Customers table itself. In Table view, you click “New column,” and you write the same sum:
Total Amount = SUM( Sales[Amount] )| Customer ID | Name | City | Total Amount |
|---|---|---|---|
| C001 | Orvane | New York | 1,700,000 |
| C002 | Kumora | New York | 1,700,000 |
| C003 | Talvio | New York | 1,700,000 |
| C004 | Ribelia | Chicago | 1,700,000 |
| C005 | Movara | Chicago | 1,700,000 |
| C006 | Northel | Toronto | 1,700,000 |
| C007 | Sam Lee | Toronto | 1,700,000 |
This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.
Each customer shows 1,700,000, the total of all the sales.
If you have already seen this 1,700,000 repeated on every row, rest assured, the formula contains no mistake. The sum is the same, and so are the customers. Why don’t the table and the visual behave the same way?
The rest of this lesson is part of izyDAX Pro
You have just read the first section. The next 4, their animations, the exercises and the summary are waiting for you with izyDAX Pro, in a single payment.