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

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

Reply
AresBert
New Member

how to Get number of element in a slicer to write a dynamic title ?

Hi everyone, 

Im trying to create a title that is linked to a slicer.


In particular:
if one elements is selected in the slicer, than the title report the elements selected
if two or more elemtes are selected in the slicer, than the title report the lable "Multiple Selection"
If all elements are selected in the slicer, than the title report "All selected"


My problem is that i can't get the static number of elemets in the slicer to write my IF statement.
I've tried with COUNTROWS(MYTABLE), but once i select some item in the slicer, the rows selected are not correct.
How can i achieve this ?

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @AresBert 
you can create a measure like (with your original table and column names) :

test =
var counterSel = IF(ISFILTERED('Table'[County]), COUNTROWS(VALUES('Table'[County])),0)
var allSel =CALCULATE( DISTINCTCOUNT('Table'[County]),ALL('Table'[County]))
return
if (counterSel=allSel, "All sellected",
if (counterSel>1, "multiple sellected",
SELECTEDVALUE('Table'[County])))
 
Result :
Ritaf1983_0-1691727331202.pngRitaf1983_1-1691727367134.pngRitaf1983_2-1691727394294.png

Link to a sample file 

Please consider Accepting it as the solution to help the other members find it more quickly

 
Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

1 REPLY 1
Ritaf1983
Super User
Super User

Hi @AresBert 
you can create a measure like (with your original table and column names) :

test =
var counterSel = IF(ISFILTERED('Table'[County]), COUNTROWS(VALUES('Table'[County])),0)
var allSel =CALCULATE( DISTINCTCOUNT('Table'[County]),ALL('Table'[County]))
return
if (counterSel=allSel, "All sellected",
if (counterSel>1, "multiple sellected",
SELECTEDVALUE('Table'[County])))
 
Result :
Ritaf1983_0-1691727331202.pngRitaf1983_1-1691727367134.pngRitaf1983_2-1691727394294.png

Link to a sample file 

Please consider Accepting it as the solution to help the other members find it more quickly

 
Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors