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.”

Table visual, The table visual by customer
NameSum of Amount
Orvane450,000
Kumora300,000
Talvio150,000
Ribelia250,000
Movara250,000
Northel200,000
Sam Lee100,000
Total1,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] )
Power BI accepts this DAX foryes, Measureyes, Calculated columnno, Calculated tableno, Virtual table
Total Amount = SUM( Sales[Amount] )
Table Customers
Customer IDNameCityTotal Amount
C001OrvaneNew York1,700,000
C002KumoraNew York1,700,000
C003TalvioNew York1,700,000
C004RibeliaChicago1,700,000
C005MovaraChicago1,700,000
C006NorthelToronto1,700,000
C007Sam LeeToronto1,700,000
Table: Customers (7 rows)

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.