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

 

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

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.