12.2The table in an iterator
An iterator, like SUMX or RANKX, goes through the table you give it, row by row. Here again, its result depends on what this table contains.
12.2.1SUMX goes through the table you give it
SUMX goes over the rows of a table, calculates a figure for each one, then adds up the results. The table given as the first argument therefore decides what gets added up.
In our data, let’s go back to the visual by city and its slicer on New York and Chicago. SUMX goes through the table of its first argument and adds up the revenue of each city:
| The table SUMX goes through | New York row | Chicago row | Total |
|---|---|---|---|
| ALL( Customers[City] ) | 1,700,000 | 1,700,000 | 1,700,000 |
| ALLSELECTED( Customers[City] ) | 1,400,000 | 1,400,000 | 1,400,000 |
| VALUES( Customers[City] ) | 900,000 | 500,000 | 1,400,000 |
Each table says:
- With ALL, “going city by city through all the cities, even those that were left out, I want to add up their revenue”
- With ALLSELECTED, “going city by city through the cities ticked in the slicer, I want to add up their revenue”
- With VALUES, “going through the only city shown, I want to take back its revenue”
With ALL, SUMX goes through the three cities, on every row. With VALUES, it only goes through the city of the row, and gives back its revenue.
On each city it goes through, [Revenue] returns the figure of that city alone, thanks to context transition. The city being gone through becomes a filter, and the measure calculates with it.
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.