Understanding row and filter contexts
Before we move on to the next set of DAX functions, let’s take a moment to understand the concepts of row and filter contexts.
Understanding this will help you write better DAX formulas.
In Excel, calculations in tables are mostly done in the current row and copied down. When we create calculations that operate on values in every single row of our tables, we are using a row context. What this means is that each row calculates differently based on its unique values. We used row contexts when we created a calculated column for the ages of our customers. The DATEDIFF
function runs an operation on the date of birth of each customer “row by row” to return the corresponding age for each customer.
Calculated columns automatically compute within an existing row context. However, when we create measures, this behavior is not there by default, and we need to find some creative ways to select rows for our calculations. This is...