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

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

Reply
Anonymous
Not applicable

count substring close to another substring

I'm looking at the returns from a messagebot and need to identify a specific response to a visitor query.

 

Bot: Would you like to see the list of content again?<br>( 41s ) Bot: {ChatWindowButton:Yes,No}<br>( 45s ) Visitor: Yes<br>( 46s ) Bot: Here is the content list again<br>

 

String1="content again?"

String2="Visitor: Yes"

I need to count this interaction as a measure called Content_Offered_Yes,  String1 AND String2 =1

 

but I also need to count this interaction as Content_Offered_Yes=1 because while "content again?" features twice there was an attempt to pass the chat to an agent, so the first instance counts as a failed offer.

 

Bot: Would you like to see the list of content again?<br>( 41s ) Bot: {ChatWindowButton:Yes,No}<br>( 45s ) Visitor: Can I talk to a human<br>( 49s ) Bot: Transferring to the next available agent.<br><p align="center">Agent Chatbot failed to transfer the chat to button Product Troubleshooting stuff</p><p align="center">Agent Chatbot chat resumed with BotId 0Xx3g000000blON</p>( 50s ) Bot: I apologize, but there are no agents available.<br>(51s)Bot: {ChatWindowButton:Yes,No}<br>(51s)Bot: Would you like to see the list of content again?<br>( 51s ) Bot: {ChatWindowButton:Yes,No}<br>(57s) Visitor: Yes<br>( 58s ) Bot: Here is the content list again<br>

 

I'm creating 2 columns with

 

= Table.AddColumn(#"Changed Type1", "Text-Visitor_Yes", each let
String = [Conversation],
Count = List.Count(Text.Split(String,"Visitor: Yes"))-1
in
Count)

 

and

 

= Table.AddColumn(#"Changed Type1", "Text-Content_again", each let
String = [Conversation],
Count = List.Count(Text.Split(String,"content again?"))-1
in
Count)

 

but this double counts "content again?" and I can't figure out how to differentiate between String1 close to String2 and String1 far away from String2

Any thoughts?

1 REPLY 1
PhilipTreacy
Super User
Super User

Hi @Anonymous 

It's a bit confusing withut the actual data and code.

Try counting the number of times failed to transfer the chat appears and subtract that from the number of times content again appears.

Regards

Phil  



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.