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
RichOB
Post Patron
Post Patron

Isolating individual contains text

Hi, how can I split these issue results into individual counts from this table?:

Issue
Medical Concern
Medical Concern; ASB - Violence
ASB - Violence
Medical Concern; Theft; Missing Person
Theft
Theft; Missing Person


I can isolate the issues by the individual ContainsString Count measures, but in my real-life scenario I have hundreds of "Issues", so I need this to be more automated for all issue types instead of creating 100 individual measures, but not sure how?

 

I need the outcome to show:

Medical Concern3
Asb - Violence2
Theft3
Missing Person2
1 ACCEPTED SOLUTION

The blank row issue typically occurs because:

  1. The source column contains empty values before splitting

  2. There are consecutive semicolons (;;) in the data, creating empty entries when splitting

Solutions

* Clean data before splitting:

= Table.TransformColumns(#"PreviousStep", {{"Issue", each if _ = null then "" else _, type text}})

* Remove extra delimiters:

= Table.TransformColumns(#"PreviousStep", {{"Issue", each Text.Replace(_, ";;", ";"), type text}})

*Split and filter out blanks:

#"SplitColumn" = Table.SplitColumn(#"PreviousStep", "Issue", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), {"Issue"})
#"Trimmed" = Table.TransformColumns(#"SplitColumn", {{"Issue", Text.Trim, type text}})
#"Filtered" = Table.SelectRows(#"Trimmed", each [Issue] <> "" and [Issue] <> null)

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

Thank you.

View solution in original post

6 REPLIES 6
Elena_Kalina
Solution Sage
Solution Sage

Hi @RichOB 

1. Use the "Split Column by delimiter" in Power Query

Elena_Kalina_0-1747752179516.png

2 Create the measure like this:

IssueCount = COUNT(YourTable[Issue])
 Elena_Kalina_1-1747752929452.png
 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

Thank you.

 

 

Hi @Elena_Kalina thanks for your reply. I have followed these steps for my real-life scenario. Unfortunately, the count is the same as if I didn't do the delimiter, but it has now added a blank row with a count of 600. Any ideas why it would add a blank row?  

The blank row issue typically occurs because:

  1. The source column contains empty values before splitting

  2. There are consecutive semicolons (;;) in the data, creating empty entries when splitting

Solutions

* Clean data before splitting:

= Table.TransformColumns(#"PreviousStep", {{"Issue", each if _ = null then "" else _, type text}})

* Remove extra delimiters:

= Table.TransformColumns(#"PreviousStep", {{"Issue", each Text.Replace(_, ";;", ";"), type text}})

*Split and filter out blanks:

#"SplitColumn" = Table.SplitColumn(#"PreviousStep", "Issue", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), {"Issue"})
#"Trimmed" = Table.TransformColumns(#"SplitColumn", {{"Issue", Text.Trim, type text}})
#"Filtered" = Table.SelectRows(#"Trimmed", each [Issue] <> "" and [Issue] <> null)

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

Thank you.

This is great, thanks so much!

rajendraongole1
Super User
Super User

Hi @RichOB  - I have attached pbix file for your reference.

Please check the file

 

Snippet FYR:

rajendraongole1_0-1747751314294.png

 

Output:

 

rajendraongole1_1-1747751398722.png

 

Hope this works.

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @rajendraongole1  thanks for your reply. I have followed these steps for my real-life scenario. Unfortunately, the count is the same as if I didn't do the delimiter, but it has now added a blank row with a count of 600. Any ideas why it would add a blank row?

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.