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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Measure not applying filter correctly

Hi powerbi community

 

I'm trying to do count on columns, in the case i get a match on certain criteria, but my measure is ignoring the global context (as in, if i filter on the criteria itself on the case where i should get no values, my result stays the same instead of 0.

 

I've been able to recreate the problem with smaller data:

 

dataid
red1
orange2
red3
orange4
red5
yellow6
blue7
orange8
blue9
orange10

 

Here "Data" and "id" are read as text.

The measures are :

 

Measure2 = MAX(COUNT(aTest[id]),0)
Measure 3 = CALCULATE([Measure2], aTest[id] = "3")

 

The expected result is that if I create a slicer on "ID" and select anything but "3", i should get 0.

But here is the result i get :

pbi_apprentice2_0-1632214907202.png

I noticed that "Measure 3" returns 1 whenever i choose an id with "Data" value "red".

 

Could someone explain me this behaviour and how to get the expected result please ?

Thank you

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try like

Measure 3 = CALCULATE([Measure2], filter(aTest, aTest[id] = "3"))

 

 

refer if needed

http://dataap.org/blog/2019/04/22/difference-between-calculate-with-and-without-filter-expression/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Try like

Measure 3 = CALCULATE([Measure2], filter(aTest, aTest[id] = "3"))

 

 

refer if needed

http://dataap.org/blog/2019/04/22/difference-between-calculate-with-and-without-filter-expression/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.