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
mikegil
New Member

Filter Context appears to be different for Vizualization Filter than row in Matrix

I am trying to create a Matrix in which some rows appear based on the value of one of their fields relative to the average for this field in the set of selected rows (controlled by slicers on that page).  A simplified version of my controlling column might be:

 

Is LP := IF([LP%] < [Selected LP%],1))

 

where Selected LP% is a value pulled from a slicer on a parameters table (say .9) and LP% is defined as some thing like:

 

LP% := VAR globalAvg = CALCULATE(AVERAGE('table'[interestingField]),ALLSELECTED()) RETURN 'table'[interestingField]/globalAvg

 

LP% and Is LP calculate just as I expect in the matrix, but if I set a Visualization Filter on Is LP to show only where it is 1, a different set of rows gets show vs. those that have a 1 in that column.  Despite the filter clearly say "Show items when the value is 1", rows are shown which have a value of 0 and it appears that some rows that should have a 1 are hidden.   I checked that this visualization filter wasn't being calculated in the Filter Context before any of my Slicers by changing the LP% formula to use ALL instead of ALLSELECTED.  I obviously get different answers as you would expect, as the globalAvg is now the average for the whole dataset without regard to the Slicers, but it is still a different set of rows that get marked with Is LP = 1 than get hidden by the visualization filter when I use ALLSELECTED.  The row value and the hidden/show rows are now in sync, so clearly it is a difference in how ALLSELECTED is being handled.  

 

I know that ALLSELECT only actually moves "back one step" in that the Row Filter is removed exposing what was the Table Filter as you enter the CALCULATE, what is throwing me is why the Visualization Filter has a different context and what I need to do to avoid falling into this trap.

 

It is probably just that I am new to this and not seeing the obvious, but if anyone has walked through this issue before and can point me in the right direction I'd be most grateful.

 

 

1 REPLY 1
v-sihou-msft
Employee
Employee

@mikegil

 

In this scenario, your LP% calculation is from current row context. I don't think it's possible to use the result of "Is LP" which has dependency on "LP%" to limit the row context  within matrix. 

 

Can share some sample data and your expected result?

 

Regards,

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.