MSK Institute LogoMSK.Institute
HomeCourses
Book Free Demo➔Sign In
Free Demo➔
MSK Institute LogoMSK.Institute

Leading computer training academy in Shikohabad for software engineering, Python, web development, and digital literacy.

ISO 9001:2015 Certified Center
Follow & Connect
4.9

Programs & Admissions

  • All CoursesCatalog
  • Learning PathsRoadmaps
  • Student ProjectsShowcase
  • Live Classes & ScheduleLive
  • Upcoming Batches
  • Campuses & LocationsHub
  • Verify Certificates
  • Book Free Demo Class

Resources & Tools

  • Free Online Mock TestsAll Tests
  • NIELIT CCC Mock TestFree
  • Course & Career FinderQuiz
  • Study Material Hub
  • All MSK ToolsHub
  • Keyboard ShortcutsNew
  • TypeQuest Speed LabTyping
  • MSK Code PlaygroundCode
  • Interactive Tutorials
  • Quick Cheatsheets

Institute & Contact

  • About MSK Institute
  • Careers & InternshipsHiring
  • Publications & Blogs
  • Gali No. 3, Near Gyan Jyoti Public School,
    Adarsh Nagar, Shikohabad, Uttar Pradesh 283135
  • +91 83930 42166
  • mskshikohabad@gmail.com
  • Hours:Mon – Sat: 8:00 AM – 7:00 PM | Sun: 10:00 AM – 2:00 PM
  • 4.9 ★(38 Google Reviews)
© 2026 MSK Institute. All rights reserved.•Privacy Policy•Terms of Service•Disclaimer•Contact Us

Shikohabad's Leading Computer & Coding Academy

Home
Courses
Live
Material
CALCULATE and FILTER Functions0%
Study MaterialsCheatsheet
Power BI for IntermediateProgress 0%
1.1Quick recap of Import, Modeling, DAX1.2Project requirements for Intermediate Level
2.1Time Intelligence Functions2.2Iterators (SUMX, AVERAGEX)2.3CALCULATE and FILTER Functions
HomeTutorialsPower BI for IntermediateCALCULATE and FILTER Functions
Many-to-Many Relationships

CALCULATE and FILTER Functions

Beginner12 min read•Updated: 2026-11-18•By Er. Sumit Kumar (MSK Institute)
Study MaterialsCheatsheet

CALCULATE & FILTER Functions: The Engine of Advanced DAX

CALCULATE is universally recognized as the single most powerful function in DAX. It is the only function capable of modifying, overriding, or adding to the active Filter Context. Without CALCULATE, advanced business metrics—such as percentage of total, target comparisons, and cross-category ratios—are impossible to compute.


1. How CALCULATE Works: Context Transition

The syntax of CALCULATE: $$\text{CALCULATE}(\text{Expression}, \text{Filter1}, \text{Filter2}, \dots)$$

1 The CALCULATE Transformation Flow
2 |
3 [Initial Filter Context: Category = "Furniture"]
4 |
5 CALCULATE([Total Sales], Dim_Product[Category] = "Technology")
6 |
7 1. Evaluates all filter arguments independently
8 2. Overwrites / Updates existing Filter Context (Category becomes "Technology")
9 3. Performs Context Transition (turns active Row Context into Filter Context if inside iterator)
10 4. Computes the base expression ([Total Sales]) under the new context

2. Using CALCULATE with ALL: Percentage of Total

A classic business metric is Percentage Contribution to Total Sales:

1-- Total Sales across all products (ignores visual row filters on product)
2Total Sales All Products =
3CALCULATE(
4 [Total Sales],
5 ALL(Dim_Product)
6)
7 
8-- % of Product Sales
9Product Sales % Contribution =
10DIVIDE(
11 [Total Sales],
12 [Total Sales All Products],
13 0
14)

3. When and Why to Use the FILTER Function

Beginners often ask: Why do we need FILTER() if CALCULATE already accepts filters?

Boolean vs. Table Filter Arguments

  1. 1
    Simple Boolean Filter:
1 -- Power BI automatically optimizes this into a column scan:
2 CALCULATE([Total Sales], Dim_Product[Category] = "Technology")

Limitation: Simple boolean filters can only filter a single column against static values or measures. They cannot compare two columns or reference measures dynamically!

  1. 1
    Table Filter with FILTER():
1 -- Required when comparing two columns or filtering by an aggregated measure:
2 High Value Customer Sales =
3 CALCULATE(
4 [Total Sales],
5 FILTER(
6 Dim_Customer,
7 [Total Sales] > 10000 && Dim_Customer[State] = "Maharashtra"
8 )
9 )

4. Preserving Slicers with KEEPFILTERS

By default, filter arguments in CALCULATE overwrite any existing filter on the same column. If you want the filter to intersect with existing user slicers instead of replacing them, wrap the condition in KEEPFILTERS:

1-- Intersects with any outer region slicer chosen by the user:
2North Region Preserved Sales =
3CALCULATE(
4 [Total Sales],
5 KEEPFILTERS(Dim_Geography[Region] = "North")
6)

Interactive Quiz• Knowledge Check

Multiple Choice Questions

Question 1
What unique capability does the CALCULATE function possess that distinguishes it from all other DAX functions?
Question 2
In the formula CALCULATE([Total Sales], ALL(Dim_Product)), what is the effect of ALL(Dim_Product)?
Question 3
When MUST the FILTER() function be explicitly passed as an argument to CALCULATE?
Question 4
What is the role of KEEPFILTERS() inside a CALCULATE statement?
Question 5
What process occurs when CALCULATE is invoked within a Row Context (such as inside a calculated column or iterator)?

Next Lesson

Many-to-Many Relationships

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Related Lessons

Previous LessonNext Lesson
Iterators (SUMX, AVERAGEX)Many-to-Many Relationships

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

12-Month Data Analysis Mastery Program

Master Full-Stack Data Analytics (Excel, SQL, Python, Power BI & Tableau)

Combine 15 complete courses, 150 chapters, 541 topics, live SQL/Power BI/Tableau dashboards, and Scikit-Learn capstones at MSK Institute Shikohabad or Live Online.

View Full CourseBook Free Demo
PreviousNext
PreviousPrevNext