pbi



Context

Some say that once you have mastered the concept of context in DAX, you have mastered


DAX. This is mostly true, and if you have indeed mastered context, you are a long way up

the learning curve.

Context can seem a little daunting at first, but once you understand the effect that

types of context have on calculations, hopefully DAX starts to make more sense. Context

is how DAX applies layers of filtering to tables used in your calculations so that they


return results that are relevant for every value.

Most context is automatic, but some context allows you to control the underlying

data passed to your DAX calculations. This chapter mostly uses pivot tables to describe

the order and effect of the different types of context. Other visuals and charts apply

the context logic the same way pivot tables do, but I think pivot tables do a good job of


showing the effect.

There are two types of context in DAX: filter context and row context. Depending on

your calculation, one or both can apply at the same time to affect the result of your DAX

calculation.

Context is the layer of filtering that is applied to calculations, often dynamically


to produce a result specific to every value in a pivot table or visual, including row and

column totals.

Filter Context

Filter context is a set of column-based filters applied on the fly to the underlying data

for every DAX calculation. It is helpful to think of every value cell in a pivot table as its


own separate computation. Each value cell treats its measure as a function and passes

relevant filters to the function to be applied to the calculation

登录后才可评论.