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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Danielwood
Helper I
Helper I

Count if certain text is in a string

Hi,

 

I am doing some measures in PBI desktop app, counting unique values where certain criteria is met. Can someone tell me what the parentheses is for searching for text within a cell.

 

I know = looks for full text, <> is does not include but not sure what I need where I'm looking for a string within the text. 

 

For context, the cell has dates in dd/mm/yy format, and I want to count where */07/* is.

1 ACCEPTED SOLUTION
DataNinja777
Super User
Super User

Hi @Danielwood ,

It appears that you are trying to count the rows where the dd/mm/yy is July month.  In that case, there are multiple ways to achive your required output.  One of them is to use calculated column like below to identify the rows to be counted.  

Contains /07/ =
IF ( CONTAINSSTRING ( 'YourTable'[Column], "/07/" ), "Contains /07/", BLANK () )

 Best regards,

View solution in original post

3 REPLIES 3
ajohnso2
Super User
Super User

Can you not convert your text date to date format??

 

Create a custom column in power query - ProperDate = Date.FromText(<Date Column>, "dd/mm/yyyy")

 

You can then create a new measure to count where your new column month = 7...

CALCULATE(DISTINCTCOUNT(<Column to Count>) FILTER(ALL('Date'), MONTH(ProperDate)) = 7)

 

syntax may not be 100% just working off memory

mickey64
Super User
Super User

DataNinja777
Super User
Super User

Hi @Danielwood ,

It appears that you are trying to count the rows where the dd/mm/yy is July month.  In that case, there are multiple ways to achive your required output.  One of them is to use calculated column like below to identify the rows to be counted.  

Contains /07/ =
IF ( CONTAINSSTRING ( 'YourTable'[Column], "/07/" ), "Contains /07/", BLANK () )

 Best regards,

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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