10.1What CALCULATE changes

In Excel
ExcelSUMIFS, COUNTIFS or AVERAGEIFS, depending on the calculation
Match

You now know that each function calculates in the filter context it is given. CALCULATE, like its neighbor CALCULATETABLE, changes this context before calculating. Here is exactly what it does.

10.1.1CALCULATE changes the context, then calculates

CALCULATE calculates a figure after changing the filters that the visual applies. It receives the calculation to carry out and the filters to place, and returns the figure obtained with these filters. Most often, you need it as soon as you want, in a visual, a figure calculated with other filters than those of the visual.

In our data, that is the case of the New York revenue on every row of a table by city.

CALCULATE changes the filter context, then evaluates its first argument in the changed context.

CALCULATE( <expression>, [<filter> …] )

The first argument is the calculation to carry out, like [Revenue]. The next ones, in square brackets, are optional. They are the filters, separated by commas.

In “Six basic functions,” a CALCULATE filter seemed only to keep rows. In fact, it acts on the context of the visual, and the result depends on this context.

The rest of this lesson is part of izyDAX Pro

You have just read the first section. The next 3, their animations, the exercises and the summary are waiting for you with izyDAX Pro, in a single payment.