Evaluation Context in DAX Artur Konstantynov
Who am I (Power) BI Developer Lead of Kyiv Power BI User Group
Me and Power BI It was the first time I heard about Power BI I’d been working as Power BI developer and wanted to know more I knew what I need to know I'm sharing my knowledge
Agenda What is Context Row Context Filter Context Context switching
Clarification Direction Knowing the direction of each relationship is critical to understand Evaluation Context Type The Vertipaq (xVelocity) engine is optimized to work with ONE to type of relationship.
What is Context Albert Einstein. General theory of relativity or GTR.
Total Qty = SUM('Sales fact'[Quantity]) What is Context Total Qty = SUM('Sales fact'[Quantity])
Row Context Exists in calculated columns Exists in iterators and filter functions (SUMX, Filter etc.) Does not support relationships
Filter Context Exists in visualizations Automatically works with direction of filtering in relationships Appears in CALCULATE() function Measures contain a Filter Context
Evaluation Context switching CALCULATE() function It’s the only one function that can modify Context Can switch Row to Filter Context Every Measure contains Calculate Filter Context Functions (FILTER(), ALL() etc.) Direction of filtering and CROSSFILTER()
Demo
References https://docs.microsoft.com/en-us/dax/data-analysis-expressions-dax-reference https://docs.microsoft.com/en-us/dax/dax-overview#context Alberto Ferrari. Bidirectional relationships and ambiguity in DAX https://www.sqlbi.com/articles/bidirectional-relationships-and-ambiguity-in-dax/ Artur Konstantynov https://www.linkedin.com/in/artur-konstantynov-715861132/ DB Best https://www.dbbest.com/ Kyiv Power BI User Group https://www.pbiusergroup.com/communities/community-home?CommunityKey=67c55d49-f851-4a9f-90c2-32465971b13d/