Calculated column does not have any filter context.
To inject a filter context we can use the CALCULATE function.
Assume I have a sales, location and date table. Sales is fact. The location and date are dimensions connected to the fact table.
Suppose I create a calculated column in the sales table with CALCULATE(SUM...))
, does the injected filter context consist only rows from sales table or does the context also consist all related table columns as well?
A use case for this is for example suppose location table is linked to sales table via locationid and has state, country, then we could use ALLEXCEPT to keep only Country filter so that for each row, the SUM in CALCULATE is aggregated by Country rather than all fields in the row.