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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
camruny
New Member

Counting Strings with Wildcard

I have a table that has a list of URLs and I would like to create a count of all of the ones that end in .com, .org, .gov etc.  How can I write a formula that will do this?

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

Hi @camruny,

Adding to other post, you can simply create a measure using CALCULATE and COUNTROWS functions to create a count of all of the ones that end in .com, .org, .gov . Here is an example for your reference.


large.png

Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yuezhe-msft
Employee
Employee

Hi @camruny,

Adding to other post, you can simply create a measure using CALCULATE and COUNTROWS functions to create a count of all of the ones that end in .com, .org, .gov . Here is an example for your reference.


large.png

Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you!  This is exactly what I was looking for!

KGrice
Memorable Member
Memorable Member

If you use the SEARCH function, you can take advantage of wildcards. Since the criteria is static, I'd probably make a new column in the data view that determines if the ending of the url matches your pattern. For example:

 

SEARCH.PNG

 

 

You can then use that column in your measures to get a count of urls that match. If you multiply the whole column formula above by 1, you'll end up with 1s for True and 0s for False, making any math you do on the column easier and more intuitive. Then you can use:

 

MatchCount = SUM(Table1[Matches])

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.