Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
PowerAutomater
Helper IV
Helper IV

How to filter something out of a Calculate function?

I have read the documentation on the calculate function but I am still not quite sure how the filter actually works, for example does what you put as a filter exclude everything else or only include what is in the filter?

For example if I want to count the total number of completed events in a particular category, but I want to exclude/filter out one specific event is this the correct way?

CALCULATE(COUNT(Query1[Completed]),Query1[Category] = "Great Events", Query1[Event Name] = "Not Great Event")

Or do I need to add in a NOT instead?

CALCULATE(COUNT(Query1[Completed]),Query1[Category] = "Great Events", NOT(Query1[Event Name] = "Not Great Event"))

 

1 ACCEPTED SOLUTION
MohamedFowzan1
Solution Specialist
Solution Specialist

Hi @PowerAutomater 

When using the Calculate function and you use Filter for example as in the above case it includes only the cases where Category is "Great Events" and Event Name is "Not Great Event"

If your goal is to exclude "Not Great Event" within the "Great Events" category, you should use:

CALCULATE(
    COUNT(Query1[Completed]),
    Query1[Category] = "Great Events",
    Query1[Event Name] <> "Not Great Event"
)


Each filter in CALCULATE includes the matching rows, you would have to specify if equal to or not equal to.
To exclude, use the <> (not equal) operator
Using "," has the same effect as the AND operator (&&), for OR (||), you would have to specify this.

If Resolved, Mark as Solution to guide others!

View solution in original post

3 REPLIES 3
MohamedFowzan1
Solution Specialist
Solution Specialist

Hi @PowerAutomater 

When using the Calculate function and you use Filter for example as in the above case it includes only the cases where Category is "Great Events" and Event Name is "Not Great Event"

If your goal is to exclude "Not Great Event" within the "Great Events" category, you should use:

CALCULATE(
    COUNT(Query1[Completed]),
    Query1[Category] = "Great Events",
    Query1[Event Name] <> "Not Great Event"
)


Each filter in CALCULATE includes the matching rows, you would have to specify if equal to or not equal to.
To exclude, use the <> (not equal) operator
Using "," has the same effect as the AND operator (&&), for OR (||), you would have to specify this.

If Resolved, Mark as Solution to guide others!

Thank you for that, I haven't come across <> before. Is this any different to adding a NOT in this way?

CALCULATE(COUNT(Query1[Completed]),Query1[Category] = "Great Events", NOT(Query1[Event Name] = "Not Great Event"))

Both these would give you the same result, it is just a couple of different ways to achieve the same.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors