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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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

 

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
Super User
Super User

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!:
Power BI Cookbook Third Edition (Color)

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

 

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))
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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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