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
QWERTYZ
New Member

How to filter by exact string

Hello,

 

I want to count the number of rows in a column that contain the string "rds" . Am using the Filters on this page and selected "Contains: RDS" and a card that shows the count result

QWERTYZ_0-1682060334955.png

But it also retrieves the data if the text contains "Regards" or any other word that has rds in it. Tried adding a space before but that would exclude the cases where the text starts with rds.

 

Any idea would be helpful 

 

Thanks !

1 ACCEPTED SOLUTION

Hi @QWERTYZ .

Try this formula :

CountRds = CALCULATE(COUNTROWS('Table'),find("rds ",'Table'[TEST],1,0)>0 || LEFT('Table'[TEST],3)= "rds" || find(" rds",'Table'[TEST],1,0)>0 )
Ritaf1983_0-1682432218967.png

If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

4 REPLIES 4
v-jingzhang
Community Support
Community Support

Hi @QWERTYZ 

 

You can create a measure to count the rows. 

Measure = COUNTROWS(FILTER('Table (2)', CONTAINSSTRING('Table (2)'[Column]," rds") || LEFT('Table (2)'[Column],3)="rds"))

But this measure doesn't exclude words like "rdse". 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

 

Ritaf1983
Super User
Super User

Hi @QWERTYZ 

I'm not quite sure what you're trying to accomplish.

Could you please attach a sample of the data?
It would be helpful if you could specify exactly what you want the lines to count.
You say you want to count everything containing RDS, but you also say some words should be excluded.
The logic behind what is required is unclear to me.

Hi,

 

For example I have these rows:

 

#  Field1

1  I will talk to him. Best regards

2  will go and play billiards

3  having issues with rds

rds has been removed

 

Want to filter only the rows that contain "rds" so it should match only rows 3 & 4. Not 1 & 2 (Regards, billiards). It is a stand alone word.

 

So I can either display only the rows I need or add a card that counts occurances.

 

Sorry if I was not clear enough

Hi @QWERTYZ .

Try this formula :

CountRds = CALCULATE(COUNTROWS('Table'),find("rds ",'Table'[TEST],1,0)>0 || LEFT('Table'[TEST],3)= "rds" || find(" rds",'Table'[TEST],1,0)>0 )
Ritaf1983_0-1682432218967.png

If this post helps, please Accept it as Solution to help other members find it.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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