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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Filter within calculate does not filter other visual

Hello,

I am new to Power BI and have been stuck with the issue that the filter in a Calculate function does not affect the filter context for another visual. I have created a small example. There is 1 table which holds responses to a survey for 3 customers. There are 4 columns: “Customer”, “Yes/No”, “Category” & “Question”. To make checking easier, each customer with “Yes” or “” in the “Yes/No” column has Category “Cat 1” and customers with “No” have category “Cat 2”.

Tim_PBI_2-1690319588718.png

Table = SELECTCOLUMNS( {
    ("Q1", "Customer 1", "Cat 1", "Yes"),
    ("Q2", "Customer 1", "Cat 1", "Yes"),
    ("Q3", "Customer 1", "Cat 2", "No"),
    ("Q4", "Customer 1", "Cat 1", ""),
    ("Q1", "Customer 2", "Cat 1", "Yes"),
    ("Q2", "Customer 2", "Cat 2", "No"),
    ("Q3", "Customer 2", "Cat 2", "No"),
    ("Q4", "Customer 2", "Cat 1", ""),
    ("Q1", "Customer 3", "Cat 1", "Yes"),
    ("Q2", "Customer 3", "Cat 1", "Yes"),
    ("Q3", "Customer 3", "Cat 2", "No"),
    ("Q4", "Customer 3", "Cat 1", "")
}, 
"Question", [Value1],
"Customer", [Value2],
"Category", [Value3],
"Yes/No", [Value4])

I have a measure to calculate the number of rows that are not blank in the “Yes/No” column.

Count Yes/No not blank = CALCULATE(COUNTROWS('Table'), 'Table'[Yes/No] <> "")

A Stacked bar chart is created with the Customer on the Y-axis and the measure on the X-axis. In the legend is the category. On the right of the bar chart there is another bar chart that shows the count of category (which represents the count of rows as the category is always filled).

The problem is that when a category is selected, the count of category still includes the rows that are blank in column “Yes/No” as the filter from within the calculate function is not in the filter context for the count of category (Filter context is extracted from DAX studio and displayed in the tooltip).

Tim_PBI_1-1690319537041.png

 

I would like to not use the “Filter on this visual” to prevent users of the report to change the filter on Yes/No as the blank rows should always be filtered out.

What should I change to have the filter on the “Yes/No” column also applied to the count of category visual?

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi  @Anonymous ,

 

Power BI does not support the direct passing of filters between our visual1 to visual2. 

If you want your visual show data that "Yes/No" is not the blank, I think you need to add the filter into the calculation.

I think you can use measure [Count Yes/No not blank] in your visual on right side instead of count Category directly.

Count Yes/No not blank = CALCULATE(COUNTROWS('Table'), 'Table'[Yes/No] <> "")

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi  @Anonymous ,

 

Power BI does not support the direct passing of filters between our visual1 to visual2. 

If you want your visual show data that "Yes/No" is not the blank, I think you need to add the filter into the calculation.

I think you can use measure [Count Yes/No not blank] in your visual on right side instead of count Category directly.

Count Yes/No not blank = CALCULATE(COUNTROWS('Table'), 'Table'[Yes/No] <> "")

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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