How to use Calculate function in Power BI

Shivam Agarwal
2 min readFeb 16, 2021

Calculate function is the most powerful function in Power BI. If used strategically it can produce wonderful insights.

Photo by Lukas Blazek on Unsplash

What is Calculate function?

Microsoft defines calculate function as “Evaluates an expression in a context modified by filters.”

Too complex to understand. Let me simplify it:-

The expression for Calculate function: Basically calculate function has two parts

An expression for Calculate function

a. Expression: What we are trying to calculate

b. Filters:- What condition we are trying to implement while evaluating the expression

How to use Calculate function: Assume we are having the sales value of four regions as per below table

Now the garment merchant wants to see the total sales in the next columns of sales. We can easily achieve this by applying the below Calculate function

  1. Expression:- Sum of Sales from the fact table
  2. Filter:- We want all sales for all-region from the state table
Result of Total Sales

Now let's enjoy the power of DAX

Now the garment merchant wants to see the percentage of sales for each region. We can easily achieve it by using DAX. Here we will be using Total Sales that is already created

Result of % of Sales

Want to see more power of Calculate functions please comment I will add give more example of Calculate function



Shivam Agarwal

Shivam is an accomplished analytics professional and algo trader, sharing expertise in algo trading, data science, and AI through insightful publications.