Krešimir Ledinski

DAX HANDBOOK
7. VARIABLES

Variables are used in almost every measure you will create. The reason we introduce them last is that they use all other parts of DAX code to produce faster, more powerful and maintainable code. Variables are like containers of a part of the DAX code which can be used throughout your measure. Few facts about …

DAX HANDBOOK
7. VARIABLES
Read More »

DAX HANDBOOK
6.8 ALLSELECTED

Explanation ALLSELECTED is one of the most complex functions in DAX. When used improperly it can lead to unexpected results. As a rule of thumb, you should not use it in iterative functions. It is preferable to use it only as a CALCULATE filter remover, not as a table function. ALLSELECTED comes into play once …

DAX HANDBOOK
6.8 ALLSELECTED
Read More »

DAX HANDBOOK
6.7 Lineage

What is Lineage? Lineage is a part of DAX mechanics that enables us to use tables as filter arguments for the CALCULATE function. It’s also used in row2filter context transition and other aspects of the data model that involve filter propagation throughout the model. We can state that lineage is the possibility to filter the …

DAX HANDBOOK
6.7 Lineage
Read More »

DAX HANDBOOK
6.6 Crossfilter

Crossfilter is a feature of DAX when it filters the underlying dataset even though there aren’t any visual filters present. Introduction In this example, we will explain a very important feature of CALCULATE filter arguments. We will also explain why you should always prefer the combination of ALL/REMOVEFILTER + VALUES instead of ALLEXCEPT function. We …

DAX HANDBOOK
6.6 Crossfilter
Read More »

DAX HANDBOOK
6.4 CALCULATE order of evaluation

Explanation CALCULATE has an evaluation order different from most other DAX calculations. We can say that it works from outer to inner CALCULATE statements. Let’s explain this with an example: Which value would the SalesMultipleCalculate measure return?a) Blank valueb) 33,702,965 (Black)c) 10,828,592 (Blue) The correct answer is B. Following is the explanation and order of …

DAX HANDBOOK
6.4 CALCULATE order of evaluation
Read More »

DAX HANDBOOK
6.3 Row 2 Filter context transition

Explanation Context transition is one of the most powerful features of CALCULATE function. Whenever we use CALCULATE inside of a row context (iterative functions like SUMX, FILTER, or in a calculated column), CALCULATE transforms row context to filter context. What is the difference? In row context, values from the current row of the iteration can …

DAX HANDBOOK
6.3 Row 2 Filter context transition
Read More »

DAX HANDBOOK
6.2 Types of filter arguments

This segmentation somewhat differs from the generally accepted one, but we find it most suitable to explain different types of CALCULATE filter arguments. In case you find any part of our explanation not precise enough, feel free to comment. CALCULATE accepts 3 types of filter arguments. Those are model modifiers, model filter removers, and tables …

DAX HANDBOOK
6.2 Types of filter arguments
Read More »

DAX HANDBOOK
6.1 CALCULATE syntax

Syntax CALCULATE([expression],filter1,filter2,…)CALCULATE has only 1 required argument, and that is the expression (measure) to evaluate. All the other arguments are optional and are used to modify the filter context in which the required argument will be evaluated. Those modifications lead to a complex and extremely powerful computational power of DAX language. It is extremely important …

DAX HANDBOOK
6.1 CALCULATE syntax
Read More »

DAX HANDBOOK
6. CALCULATE

Introduction CALCULATE/CALCULATETABLE are the most important functions in DAX, and the only ones that are capable of modifying the original filter context. CALCULATE has a few rules you need to follow, and they aren’t that hard to understand. The complexity comes when those rules interfere with each other or with the original filter context. Original …

DAX HANDBOOK
6. CALCULATE
Read More »

Scroll to Top