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
CamronBute
Frequent Visitor

CALCULATE() not filtering correctly?

Consider the following query result (in the Edit Queries screen):

image.png

 

Now here are two measures I have made on that query:

image.pngimage.png

 

This is the result:

image.png

 

I expected to see:

image.png

 

 

Am I missing something, or is this a bug?

2 ACCEPTED SOLUTIONS
tringuyenminh92
Memorable Member
Memorable Member

Hi @CamronBute,

 

To use these method or multiple conditions in filtering, please wrap them in Filter method

 

CALCULATE([Total Views],FILTER(Views,NOT(ISBLANK(Views[Who]))))

Capture.PNG

 

View solution in original post

OwenAuger
Super User
Super User

Hi @CamronBute

 

Two reasons I believe are contributing to your unexpected results:

  1. The empty values in the Who column are empty strings rather than null values (empty strings and nulls look the same in Data view, but are distinguishable in the Query Editor).
  2. CALCULATE filter arguments overwrite the filter context (by default) rather than intersecting with it.

Assuming the blank names are empty strings, this code should work:

 

 

Total authenticated views =
CALCULATE (
    [Total Views],
    Views[Who] <> "",
    VALUES ( Views[Who] )
)

 

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

4 REPLIES 4
OwenAuger
Super User
Super User

Hi @CamronBute

 

Two reasons I believe are contributing to your unexpected results:

  1. The empty values in the Who column are empty strings rather than null values (empty strings and nulls look the same in Data view, but are distinguishable in the Query Editor).
  2. CALCULATE filter arguments overwrite the filter context (by default) rather than intersecting with it.

Assuming the blank names are empty strings, this code should work:

 

 

Total authenticated views =
CALCULATE (
    [Total Views],
    Views[Who] <> "",
    VALUES ( Views[Who] )
)

 

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Yes, I see now. Thank you for explaining the behaviour I was missing, too.

tringuyenminh92
Memorable Member
Memorable Member

Hi @CamronBute,

 

To use these method or multiple conditions in filtering, please wrap them in Filter method

 

CALCULATE([Total Views],FILTER(Views,NOT(ISBLANK(Views[Who]))))

Capture.PNG

 

Yes, this works. Thank you!

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