Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

Explain filter context and row context in DAX, and what CALCULATE does.

Row context means "the current row". It exists in calculated columns and inside iterator functions such as SUMX and FILTER. It lets you reference other columns of the same row.

Filter context is the set of filters applied when a value is evaluated — from slicers, from the rows and columns of a visual, from page filters, and from relationships. A measure returns a different number in every cell because each cell has a different filter context.

CALCULATE is the most important function in DAX because it is the only one that modifies filter context.

Sales LY =
CALCULATE(
    [Total Sales],
    SAMEPERIODLASTYEAR('Date'[Date])
)

It evaluates the first argument under filter conditions you specify. It can add filters, remove them with ALL or REMOVEFILTERS, or replace them.

The classic pattern is percentage of total, which needs the denominator to ignore the current row's filter:

% of Total =
DIVIDE([Total Sales], CALCULATE([Total Sales], ALL(Product)))

Note: CALCULATE also performs context transition — inside a row context it converts the current row into an equivalent filter context. This is why wrapping a measure in CALCULATE inside SUMX behaves differently from calling it directly, and it is the single concept that most often trips people up in DAX interviews.

All Power BI interview questions

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as