CALCULATE is the most important function in DAX because it evaluates an expression in a modified filter context. Its basic syntax is CALCULATE(expression, filter1, filter2, ...), where each filter argument can be a Boolean condition, a table expression, or a modifier such as KEEPFILTERS. When a filter argument targets a column that is already being filtered elsewhere, CALCULATE replaces the existing filter on that column rather than adding to it, an effect sometimes called filter shadowing. When CALCULATE is called without any filter arguments, it still transforms the current row context into an equivalent filter context, a behavior used to force measure evaluation within row contexts such as calculated columns.
A family of functions works alongside CALCULATE to remove or preserve filters. ALL removes all filters from a table or column and is commonly used inside CALCULATE to compute ratios unaffected by slicers, such as a percentage of grand total. ALLEXCEPT removes all filters except those on the columns listed, preserving specific filters while clearing others. REMOVEFILTERS performs the same role as ALL but with clearer intent and is the recommended syntax for clearing filters. KEEPFILTERS modifies CALCULATE behavior so that the new filter argument intersects with existing filters instead of replacing them, which is useful for additive filtering logic. ALLSELECTED returns rows visible inside the current visual context while ignoring filters applied outside the visual, making it ideal for percentages of visual totals.
Other functions alter how relationships propagate filters. USERELATIONSHIP activates an inactive relationship during a CALCULATE evaluation, allowing measures to query through alternate paths such as order date versus ship date. CROSSFILTER temporarily changes the filter direction of a relationship to None, OneWay, or BothWay for the duration of a calculation. Together, these functions give DAX authors precise control over the filter environment, enabling complex analytical logic without altering the underlying data model.