DAX - CALCULATE Flashcards
What does the Calculate expression do?
Evaluates an expression in a context modified by the specified filters.
CALCULATE syntax
CALCULATE ( expression, filter1, filter2, ... )
What happens to the CALCULATE function if you already have filters on the columns you are using in the CALCULATE expression?
Your filter in CALCULATE will override them
How can you keep filters that already exist when using CALCULATE?
Use KEEPFILTERS
What are the five CALCULATE modifiers?
- CROSSFILTER
- ALL
- USERELATIONSHIP
- KEEPFILTERS
- REMOVEFILTERS
What are the three types of filters that can be used in CALCULATE?
- Boolean filter expressions
- Table filter expressions
- Filter modification functions
Which function modifies the existing evaluation context?
CALCULATE
How does the CALCULATE function alter filter context for measures?
It can change the context under which a calculation occurs, through the addition or removal of filter constraints.
What does the CROSSFILTER function allow you to do?
- Change cross-filter direction for a specific measure while maintaining the original settings.
OR
- Disable a relationship between tables
What is the only place a CROSSFILTER function can be used?
Within a DAX function that accepts a filter as an argument.
CROSSFILTER syntax
CROSSFILTER( Table1[ColumnName1], Table2[ColumnName2], FilterDirection )
The first column is typically the many side of the relationship and the second column is the one side.
Where are filter functions normally used?
Within the CALCULATE function
What are the FilterDirection arguments that can be used in CROSSFILTER?
- None
- Both
- Oneway (Filters applied on one side)
What are the FilterDirection arguments that can be used in CROSSFILTER for one to one relationships?
oneWay_rightfiltersleft
from right to the left side of the relationship
oneWay_leftfiltersright
from left side to the right side of the relationship
When working with Boolean data types, what represents TRUE or FALSE?
TRUE=1
FALSE=0
What are the five rules that Boolean filter expressions must abide by?
They can:
- Reference columns from a single table.
They cannot:
- Reference measures
- Use a nested CALCULATE function
- Use functions that scan or return a table
- Use aggregate functions