# Dan: 8. kolovoza 2022.

## DAX HANDBOOK7. 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 HANDBOOK6.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 HANDBOOK6.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 HANDBOOK6.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 HANDBOOK6.5 Expanded tables

When using whole tables as filter arguments to CALCULATE, you are using an expanded version of the model, which consists of the table used in the arguments, as well as all other tables in the data model that are linked to that table through a 1-* relationship. We will explain this concept with a small …

## DAX HANDBOOK6.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 HANDBOOK6.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 HANDBOOK6.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 HANDBOOK6.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 HANDBOOK6. 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 …

Scroll to Top