How to use Calculate function in Power BI

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

Photo by Lukas Blazek on Unsplash

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

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store