Here is a calculation:
CALCULATE ( [Total Sales], FILTER ( Products, Products[Color] = "Red" ) )
Let’s say you call this measure in a table visual where on the rows you have Brands
Before CALCULATE starts its job what is the filter context of a cell? Let’s say it is Products[Brand] = “Contoso”
Now CALCULATE starts, it will evaluate FILTER ( Products, Products[Color] = “Red” ) in the filter context outside CALCULATE that is Contoso and all the columns of Products that are for Contoso and Red would be kept aside for a while.
CALCULATE makes a copy of the original filter context to make a new filter context with all the filter arguments evaluated in the previous step and the modifiers that it will evaluate later.
Then context transition happens only if CALCULATE is invoked in a row context, either in a calculated column or in an Iterator function.
Then the calculate modifiers such as ALL/ALLSELECTED/KEEPFILTERS/CROSSFILTER etc are applied to modify the effect of context transition or change the behavior of relationships or how a single filter argument of CALCULATE interacts (KEEPFILTERS is used in this case) with filter context outside CALCULATE .
and once CALCULATE modifiers have done their job, the filter arguments that were evaluated in the first step are applied to the new filter context and then a measure is evaluated. i.e Products[Brand] = “Contoso” & Products[Color] = “Red” would be applied to the new filter context.