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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
rbreneman
Helper II
Helper II

Help with measures to hide data based on filter selection

Hi!

I've tried this two different ways and I would expect both to work but that is not the case. Can someone help me figure out why the IsFiltered option isn't responding the way I would expect?

 

I have a column chart with a card and measure behind it to display text telling the user to go select something from a slicer. I've tried two different options to determine whether or not something is filtered on the slicer. I dropped a temporary multi-row card on the page so you can see the output of the measures. Both measures are formatted as whole number. Thanks in advance for any help!

 

1st Measure (Calculate) is this: 

Calculate = 
VAR TotalDistricts = CALCULATE(DISTINCTCOUNT('BOCES and N/RC'[DISTRICT_SHORT_NAME]),ALL('BOCES and N/RC'[DISTRICT_SHORT_NAME]))
RETURN
IF(CALCULATE(DISTINCTCOUNT('BOCES and N/RC'[DISTRICT_SHORT_NAME]),ALLSELECTED('BOCES and N/RC'[DISTRICT_SHORT_NAME]))<TotalDistricts,1,0)

This one produces the intended result except for when the user wants to select all the districts in the slicer, it ends up hiding all of the data because the filtered count now matches the TotalDistricts count. I understand why this is happening, which leads me to try option 2 below.

Calculate.png

 

2nd Measure (IsFiltered) is this:

IsFiltered = IF(ISFILTERED('BOCES and N/RC'[DISTRICT_SHORT_NAME]) = FALSE(),0,1)

This one produces the correct 0 or 1 output and would solve my issue above when the user wants to select all, but when dropping the measure into the "Filters on this visual" the visual doesn't respond. I can't understand why the visual won't filter on this like it does with option 1.

IsFiltered.png

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

Hi, @rbreneman ;

Please try to create a new table and establish a relationship:

new = SUMMARIZE('BOCES and N/RC',[DISTRICT_SHORT_NAME])

and create a ralationship:

vyalanwumsft_0-1627287481998.png

then create a measure:

IsFiltered = IF(ISFILTERED(new[DISTRICT_SHORT_NAME]),1,0)

The final output is shown below:

vyalanwumsft_1-1627287528482.pngvyalanwumsft_2-1627287538559.png

Best Regards,
Community Support Team_ Yalan Wu
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

4 REPLIES 4
v-yalanwu-msft
Community Support
Community Support

Hi, @rbreneman ;

Please try to create a new table and establish a relationship:

new = SUMMARIZE('BOCES and N/RC',[DISTRICT_SHORT_NAME])

and create a ralationship:

vyalanwumsft_0-1627287481998.png

then create a measure:

IsFiltered = IF(ISFILTERED(new[DISTRICT_SHORT_NAME]),1,0)

The final output is shown below:

vyalanwumsft_1-1627287528482.pngvyalanwumsft_2-1627287538559.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yalanwu-msft,

 

That worked! Thank you, thank you, thank you!! I won't pretend to understand why it needed to be done this way (using a new table) but it works and that is all that matters!

 

I greatly appreciate your help!

Ryan

v-yalanwu-msft
Community Support
Community Support

Hi, @rbreneman ;

For ISFILTERED() funtionTRUE when ColumnName is being filtered directly, or when any column of TableName is being filtered directly.

And in your 2 option (ISFLRER() measure) , your visual apply measure 'IsFiltered' into Filters on this Visual, And it's set to not 0, so no matter what your slicer chooses, your chart visual is always going to be filtered, so it's always going to return 1 in current chart visual, compared to the Card visual, it's not filtered, so it can change  1 or  0 depending on what the slicer chooses.

vyalanwumsft_0-1627023365025.pngvyalanwumsft_1-1627023827364.png

vyalanwumsft_2-1627023877228.png

ISFILTERED is for any filter, including Slicer or filter. So in this case, it is more applicable to Discount instead of ISFILTERED.

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much for your reply. That makes sense. My only problem with using the calculate measure for this is how to work around if the user wants to select all in the slicer. I want the visual to behave like this:

  • Do not show data when nothing is selected in slicer (working today)
  • Show data when one or more items are selected in slicer (working today)
  • Show data when all items are selected in slicer (not working, measure reverts to "0" and data disappears)

The pbix you created and attached shows this behavior (screenshot below). If you multi-select A, B, C, and D in the slicer, the table that is filtered by calculate disappears. I need to be able to keep the visual blank until a user chooses something in the slicer, but also need to account for if they select all in the slicer. Is this possible? Thanks!

rbreneman_0-1627041318424.png

 

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.