PBI CourseDAX-Pt3 What is calculate Function
In Power BI, the CALCULATE function is one of the most powerful and essential DAX functions.
PBI CourseDAX-Pt3 What is calculate Function

In Power BI, the **CALCULATE** function is one of the most powerful and essential DAX functions.
What does CALCULATE do?
CALCULATE evaluates an expression (like SUM, COUNT, AVERAGE, etc.) in a modified filter context.
In simple words:
*“CALCULATEchanges or adds filters to the current calculation."*
💡 Comparing Total Sales with Main Branch Sales (e.g., Islamabad)
To compare total sales across different product categories with the sales of your main branch (e.g., Islamabad), follow these steps:
- Select the main table in your Power BI data model.
- Click on “New Measure” from the ribbon.
- In the formula bar that appears, write the DAX expression for the main branch sales. For example:
Islamabad sales = CALCULATE(SUM(Data[Sales Amount]) , Data[Location] = "Islamabad")
Why is it important?
- It lets you override or add filters even when visuals already have their own.
- It’s crucial for time intelligence, conditional logic, and customized calculations.
This DAX formula:
- Calculates the total sales only for Islamabad.
- Overrides any external filters on the
Locationcolumn. - Ensures that Islamabad's sales appear consistently across each row, regardless of other filters in visuals.
Why is this meaningful? This approach is helpful when report viewers want to compare other cities or product category sales against a benchmark—like Islamabad’s sales. It provides a clear point of reference, making insights more meaningful and consistent across the report.
✅ This technique was also demonstrated in the previous article for better understanding.

Calculating Percentage Sales Across All Locations
The goal is to calculate the percentage of sales from a specific city compared to the total sales across all cities. To do this:
- Create a new measure that calculates total sales across all cities, regardless of any filters applied.
- Use the
CALCULATEfunction with theALLfunction to remove the filter from theLocationcolumn.
All Loc Sales = CALCULATE(SUM(Data[Sales Amount]), ALL(Data[Location]))
Explanation:
SUM(Data[Sales Amount]): Sums up the sales amount.ALL(Data[Location]): Removes filters from theLocationcolumn, so you get the grand total of sales from all cities in the dataset.
The visualization looks something like this.

Now we need to calculate the percentage of total sales by location. To do this, we’ll create a new measure called Percent of Location Sales. In this measure, we'll divide the Total Sales (which we've already created) by the All Location Sales measure.
Percent of Location Sales = [Total sales] / [All Loc Sales]
The visualization looks something like this.

📂 Dataset & Power BI Files All related datasets and Power BI files are available here: 🔗 GitHub Repository
메타데이터
- post_id
- 11efb48e2f80
- slug
- pbi-coursedax-pt3-what-is-calculate-function-11efb48e2f80
- url
- https://medium.com/@matif2k13/pbi-coursedax-pt3-what-is-calculate-function-11efb48e2f80
- canonical_url
- https://medium.com/@matif2k13/pbi-coursedax-pt3-what-is-calculate-function-11efb48e2f80
- author_url
- https://medium.com/@matif2k13
- status
- ok
- fetched_at
- 2026-06-23 03:48:11