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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Sliced table row total

Hi!

 

I've followed the procedure outlined in this website https://radacad.com/search-in-power-bi-table-visual-using-a-slicer-for-contains-character-criteria which details how to slice a table based on whether entries contain particular text.  However, I can't seem to make a measure for a card visual which could report the number of rows in the sliced table.

 

Unfortunately the data that I'm working with is a bit sensitive so I can't share my files, but from the example in the website above, what I would like to do is report, for example, the total number of customer names that contain the letter "a".  Seems pretty simple but all of my attempts have failed.

 

Thanks!

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@Anonymous So, that's just an example of a Complex Selector. The Complex Selector - Microsoft Power BI Community

 

To get this in a Card visualization, do this:

Measure = 
  VAR __Table = ADDCOLUMNS('Table',"__Selector",[Selector Measure])
RETURN
  COUNTROWS(FILTER(__Table,[__Selector] > -1))


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

View solution in original post

6 REPLIES 6
Greg_Deckler
Community Champion
Community Champion

@Anonymous So, that's just an example of a Complex Selector. The Complex Selector - Microsoft Power BI Community

 

To get this in a Card visualization, do this:

Measure = 
  VAR __Table = ADDCOLUMNS('Table',"__Selector",[Selector Measure])
RETURN
  COUNTROWS(FILTER(__Table,[__Selector] > -1))


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...
Anonymous
Not applicable

Ah I see.  This worked perfectly!  Thanks so much @Greg_Deckler !

 

As a bonus - what if I'd like to slice by more than one complex selector?  So in your example, say I wanted to slice by the number of weeks and if a state contained particular text (or some other sort of slice that isn't simply state name I suppose).

@Anonymous Probably something like:

Measure = 
  VAR __Table = ADDCOLUMNS('Table',"__Selector",[Selector Measure])
RETURN
  COUNTROWS(FILTER(__Table,[__Selector] > -1) && [NoOfWeeks] = 12)


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...
Anonymous
Not applicable

So if I understand this correctly @Greg_Deckler , in that instance the [NoOfWeeks] would be known to be 12.  But what if I want this to be another user input, likely via a separate complex selector?

@Anonymous Or you could just use a VAR and set it equal SELECTEDVALUE to grab the selected item in the slicer



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...
Anonymous
Not applicable

@Greg_Deckler You're 100% correct.  I ended up with:

 

 

Measure = 
  VAR __Table = ADDCOLUMNS('Table',"__Selector1",[Selector1 Measure],"__Selector2",[Selector2 Measure])
RETURN
  COUNTROWS(FILTER(__Table,[__Selector1] > -1 && [__Selector2] > -1))

 

 

 

Thanks so much for your help!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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