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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anthony_W
Helper I
Helper I

Create a measure that states whether value has been filtered by a slicer or not in a table.

Hi,

 

I am trying to create a measure that indicates (e.g. Yes or No) whether the current row of values in a Table has been selected by a slicer on the same report page. 

 

For example, I have the following table on a report page. There is also a slicer for 'Section' where you can chose from A, B, C, D, or E. More than one Section can be selected. If I selected Section A in the slicer, I want all rows for Section A to show Yes in the Selected by Slicer Column. The other rows should show No.

 

I have attempted possible solutions using selectedvalue, but they all end up with the same value for all of the rows. I believe I am not calculating the context correctly in my dax code.  

 

Note that I changed the interaction between the slicer and the table such that the table is not filtered when a slicer value is selected (otherwise the not selected Section rows would disappear).

 

Ultimately what I am trying to do is pass a large dataset into a custom R visual. The large dataset will contain a column stating whether the row is the filtered dataset or not. The visual will use all of the data, as well as the data selected by the user using slicers etc to generate the visualisation.

 

Any ideas on how to show whether the row values in a table have been filtered by slicers or not? 

 

 Thanks in advance for your help.

 

YearSectionPartTonnesSelected by Slicer
2020A1167Yes
2020A2258Yes
2020B1476No
2020B212No
2020C1246No
2020D1106No
2020D2331No
2020E1460No
2021A1325Yes
2021A2391Yes
2021B1262No
2021B2424No
2021C1147No
2021D1332No
2021D2281No
2021E1108No
2022A1207Yes
2022A2499Yes
2022B1299No
2022B2184No
2022C1203No
2022D1292No
2022D2485No
2022E1423No
2023A130Yes
2023A2339Yes
2023B1465No
2023B2280No
2023C1286No
2023D1487No
2023D2139No
2023E1280No

 

1 ACCEPTED SOLUTION

@Anthony_W ,

Edit interaction was the issue. I corrected it. Done little change in formula. Both formula working now

 

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

6 REPLIES 6
Greg_Deckler
Community Champion
Community Champion

First, you will need a disconnected table of your slicer values. Let's call that table Sections and you have a Section column in that table with values like:

A

B

C

D

 

Now, you create a measure like this:

Measure = 
  VAR __SlicerValues = 'Sections'
RETURN
  IF(MAX('Table'[Section]) IN __SlicerValues,"Yes","No")


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks for the suggestion Greg.

 

see below for a link to PBIX file to work this out. I added your measure but it didn't work. Any other ideas or did I do something wrong in implementing your solution?

 

https://mylecnet-my.sharepoint.com/personal/anthony_williams_abmylec_com_au/_layouts/15/onedrive.asp...

@Anthony_W ,

Edit interaction was the issue. I corrected it. Done little change in formula. Both formula working now

 

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

Thanks Amitchandak,

 

I checked the updated report and it does work. I updated the report to include 2 different slicers, and this works too.

 

Thanks.

amitchandak
Super User
Super User

Try like

measure =
var _max = maxx(allselected(Table),Table[Section]) // or take Today()
return
calculate(if(firstnonblank(Table[Section],blank()) ="_max","Yes","No"),all(Table))
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

Thanks for the suggestion Amitchandak.

 

see below for a link to PBIX file to work this out. I added your measure but it didn't work. Any other ideas or did I do something wrong in implementing your solution?

 

https://mylecnet-my.sharepoint.com/:u:/g/personal/anthony_williams_abmylec_com_au/EbGrr1JyptZBsi3Pof...

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.