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

Count textcodes in a combined column

Hello everyeone,

 

I have created a combined column in my table which contains textcodes from multiple columns. It looks like this :

 

RCOM; RPOT; RAM*; RBC*; RCOM

 

I would like to be able to count, for example, the number of times where the RCOM textcode appears in my column. How can I do that ?

1 ACCEPTED SOLUTION

Hi @Anonymous,

 

Yes, the formula below should work in this scenario. Smiley Happy

 

=List.Count(List.PositionOfAny(List.Transform(Text.Split(Text.Trim([Column1]),";"),each Text.Start( _ , 4)),{"RCOM"},Occurrence.All))

findtext.PNG

 

Regards

View solution in original post

3 REPLIES 3
v-ljerr-msft
Employee
Employee

Hi @Anonymous,

 

Based on my test, you should be able to use the following M query to add a new custom column in Query Editor under Add Column tab to get the the number of times where the RCOM textcode appears in your column. Smiley Happy

 

=List.Count(List.PositionOfAny(Text.Split(Text.Trim([Column1]),";"),{"RCOM"},Occurrence.All))

textcodecount.PNG

 

Regards

Anonymous
Not applicable

It works ! Thanks @v-ljerr-msft!

 

Do you think it's possible to do this on partial parts of text ?

 

If i have for example RCOM01, RCOM02, RCOM03, i would like to be able to count the number of times when "RCOM" appears...

 

Thank you again 🙂

Hi @Anonymous,

 

Yes, the formula below should work in this scenario. Smiley Happy

 

=List.Count(List.PositionOfAny(List.Transform(Text.Split(Text.Trim([Column1]),";"),each Text.Start( _ , 4)),{"RCOM"},Occurrence.All))

findtext.PNG

 

Regards

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.