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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
Microsoft Employee
Microsoft 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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors