In this video I talk about what context transition is and how it works. I also use two examples to show how to leverage it in the DAX code.
Timestamps
00:00 Intro
00:49 The Bad and the Ugly
06:26 The Good & Use Cases
You can download the Power BI file with the examples from my Google Drive:
[ Ссылка ]
#yourownkpi #yokpi
Summary
Context transition is a feature of the CALCULATE function that turns the given row context of a table into a filter context, which filters the whole model.
The Bad → you can’t see context transition so you kind of have to imagine it
Where does it happen?
It can happen only where you have a row context. Row context is automatic in calculated columns and in measures you have to use an iterator function to generate it.
When does it happen?
If you use CALCULATE with the row context
The Ugly → Context transition is confusing and makes DAX harder to understand
How context transition works?
During iteration CALCULATE looks at the column values in the given column and turns them into a filter context. This filter context narrows down the table for a set of values (based on the filters) to return the calculation result.
In many cases this set of values contains only the given row, since all the columns have unique values. But if you have multiple rows with identical values, all these rows will be filtered.
After the context transition happens, there is no row context anymore only filter context.
The Good → Context transition makes DAX easier to code
It can be useful for calculations.
In the video there is a use case for building a slicer for relative sales performance and another use case for creating a card visual with the value of the maximum monthly sales.
Power BI Context Transition - The Good, the Bad and the Ugly
Теги
context transitionpower bi context transitionpower bi context transition examplepower bi context transition use casehow context transition works power biwhat is context transition power biwhy context transition power bipower bi context transition examplescontext transition daxcontext transition dax examplecontext transition dax use casehow context transition works daxpower bi tutorialpower bi for beginnerspower bi how topower bipower bi course