# Evaluation Context In DAX Calculations

In this tutorial, we’ll learn about evaluation context in DAX.

Evaluation or initial context is the environment from which your dynamic calculation is based from.

It’s important to understand how evaluation context works and how it affects your DAX calculation. So in the next section, I want to show you the different ways to create the evaluation or initial context.

## Creating Evaluation Or Initial Context In DAX

First, you need to have a Date slicer and City filter in your table to achieve dynamic data.

Thereâ€™s always an initial context that you need to be aware of before doing any calculation. You can find the said evaluation context from any location.

In the sample table, the context can be found from the Date slicer or from the City filter. For example, if you select the Christchurch filter, the results in the table will change. If you also adjust the dates from the 1st of January to the 19th of January, you can see that the results changed.

For example, for the 1st of January, the result is 90,074.80 while on the 19th of January, itâ€™s 111,293.70. This proves that evaluation context can really change for every single result in DAX calculations.

To show you another example, letâ€™s turn the existing table into a Total Sales by Date visualization.

When you select or clear a filter or even adjust the time frame, you can get a new result inside the visualization.

The key thing to note is that the formula that we are using in this table and visualization doesn’t change. It is exactly the same formula.

In Excel, every single formula you see will be slightly different because the cell references will be different. In Power BI, the formula stays exactly the same. What changes the result is the context or the environment in which it is evaluated. This applies for every measure you create.

Every calculation you do within Power BI has an initial context that you need to understand. Before you look at any individual result, you need to understand the current context of that calculation.

If you didn’t know what was selected in the city slicer, you would be looking at this visualization and know that this is the Total Sales by Date. But what kind of Total Sales is it?

In the example below, you’ll know that the total sales displayed in the visualization are from Hamilton based on the slicer.

## Relationship Between Context And Data Model

Understanding how this context works is a crucial part of learning and understanding DAX – because this is as easy as it gets. You can then start manipulating the context within formulas and start doing some advanced analysis.

Hopefully, you’re also starting to see how important the model is because the context is directly created by the relationships among your tables.

The city slicer that we are selecting is from the Regions table while the calculation of Total Sales is in the Sales table.

This is called filter propagation.

Filters propagate down the relationship through the arrows and they head towards the many sides on the fact table, which is the Sales table in this case.

You can do as many of these things at any one time because the context can come from one lookup table and another lookup table. And then we could layer even more and create more context. We just have to understand what the initial context of the calculation is.

## Conclusion

Filters and slicers are basic ways to create evaluation context in your DAX calculations.

I hope you understand just how important evaluation (initial) context is. If you want to do an advanced analysis later on, youâ€™ll have to change the context within your formulas.

Cheers!

Sam

## Extended Date Table Power Query M Function

In today's blog post, we'll take another look at the Power Query M function for the extended date...

## Rule Of Thirds: The Composition Rules

When it comes to presenting the story, we need to start with the layout. This is where the rule of...

## Icons In Power BI | DAX, UNICHAR, UNICODE & Custom Images

Icons in Power BI are used to communicate meaning and add more context. You can use them as an...

## How To Compare Two Lists Of Calculated Data Virtually – An Advanced DAX Technique

When working with calculated data, comparing different data sets will sometimes be necessary. I'm going...

## Heat Map – A Great Visualization For Power BI Reports

In this tutorial, youâ€™ll learn how to create a heat map visual using Charticulator. It is used to...

## CALCULATE Function – How It Can Affect Your Calculations On Power BI

In this tutorial, I want to show you what the CALCULATE function can do through a few examples....

## Remove Empty Columns In Power BI

This blog will demonstrate how to automatically remove all empty columns in Power BI through the Power...

## DAX Calculation Groups – Power BI Report for Problem Of The Week #7

I'm going to talk about the solution I came up with for the 7th Problem of the Week. The problem...

## Publishing PowerApps Applications and Changing The Screen Order

In this tutorial, we're going to talk about publishing PowerApps applications and making sure the...

## Power BI Financial Reporting: Allocating Results To Templates At Every Single Row

Here I want to showcase a unique idea around financial reporting, which is allocating results to...

## Optimizing Queries For A Faster DAX Performance

This tutorial will talk about optimizing your queries in DAX Studio. You'll also learn how to mitigate...

## Format Data In Power BI: Addressing Irregular Data Formats

In today's blog post, we'll discuss Problem of the Week #6. I'll show you how to format data in Power...