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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
JWifoe
Regular Visitor

Measure seems to ignore filter in visual

Hello all,

I am using Power BI now for some time now but I still would say that I am basically a beginner.

From time to time I encounter something I always have to find some work around but I don't really understand, what and why is happening here.

I searched the documentation, the board and youtube but didn't find an explanation. Maybe someone could be so kind to point me in the right direction.

I made a short, very basic example:

 

my data model:

Snag_17e23137.png

I created 2 measures:

( I know that these measures are not exactly best practice, but I think they are ok to explain what my issue is)

 

Number of Orders =

CALCULATE(COUNTROWS(Orders),Orders[Customer] = MAX(Customer[Name]))

 

Is Customer =

IF([Number of Orders] > 0, "Yes", "No")

 

Both measures work fine:

Snag_17e46b39.png

When I use a Slicer and only the measure number of orders the result is as expected:

 

Snag_17e88c1b.png

 

But when I also put the Measure "Is Customer" in the visual, this happens:

 

Snag_17ee93cf.png

I don't understand why this is happening.

 

Any feedback will be very much appreciated.

 

Best regards,

Jens

1 ACCEPTED SOLUTION

@JWifoe,

 

I would need to see your pbix to be sure. Your data model uses a snowflake schema which is not recommended. A star schema works best with Power BI. Can you merge the tables Groups and Customer?

 

In the measure, you could add a second condition that tests for BLANK:

 

IF ( [Number of Orders] > 0 && [Number of Orders] <> BLANK(), "Yes", "No" )

 

Also, look at "strictly equal to" to handle blanks:

 

https://dax.guide/op/strictly-equal-to/ 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
JWifoe
Regular Visitor

Hi,

thx.

I changed the measure and now it checks whether the row should be evaluated at all (if not, I get Blank(), if yes but no orders, I get a "0") and now it works the way I would like it to.

But neverteheless I will modify my data model.

 

best regards,

 

 

Number of Orders =
VAR NoO =
    COUNTROWS ( Orders )
RETURN
    IF (
        CONTAINS ( Groups, Groups[Groups], MAX ( Customer[Group] ) ),
        IF ( NoO > 0, NoO, 0 ),
        BLANK ()
    )
DataInsights
Super User
Super User

@JWifoe,

 

This is due to the following:

 

BLANK() > 0 = FALSE

 

When the measure [Number of Orders] returns BLANK, it causes the IF statement to resolve to "No". Thus, even though [Number of Orders] is blank for a Name, a row for that Name will appear since [Is Customer] returns "No".





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi, thank you for your answer.

But I still don't understand why Power BI is even doing the calculation for a row that should be filtered out.

To put it maybe in another way: How would I have to change the measure (or is this maybe not possible with a measure and I would have to use calculated column?) in below example so that the visual show only the rows with group a or b (corresponding to the slicer) but also rows with "Number of Orders" = 0.

 

Snag_219211e8.png

@JWifoe,

 

I would need to see your pbix to be sure. Your data model uses a snowflake schema which is not recommended. A star schema works best with Power BI. Can you merge the tables Groups and Customer?

 

In the measure, you could add a second condition that tests for BLANK:

 

IF ( [Number of Orders] > 0 && [Number of Orders] <> BLANK(), "Yes", "No" )

 

Also, look at "strictly equal to" to handle blanks:

 

https://dax.guide/op/strictly-equal-to/ 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors