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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Adding Commas to Text

Hello,

My data source is a SharePoint list and I want to add a comma within a text column so that it be cleanly split by a delimiter. This is how the text appears in some of the rows:

 

BaCLH-20LH-21LH-23

 

I want to add commas so that it looks like this:

 

BaC,LH-20,LH-21,LH-23

 

If the first part was just four characters, that would be a clean split but the first part has three characters. I have also tried SplitTextBy.CharacterTransition but that did not work effectively.

 

After the text gets split into different columns, each individual item (BaC, LH-20, LH-21, and LH-23) will then be summed and used in visualizations.

 

Does anyone have any ideas?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , I power query use Split by position, multiple times with 3,4,4 and the create columns. If needed append them again

https://learn.microsoft.com/en-us/power-query/split-columns-positions

 

For visual you can also consider this approach after splitting and combine 

 

Power BI- Text Part slicer to filter/search text - https://youtu.be/MKKWeOqFG4c
https://medium.com/@amitchandak/power-bi-search-text-parts-in-text-ad2f9783ffa2

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

What I did so far was change the three-letter 'BaC' into a four-letter one and then could split by number of characters as they now were all the same number. Once divided, I could revert the three-letter one into its original form.

Ashish_Mathur
Super User
Super User

Hi,

What common logic has to be deployed for inserting commas?  Please take a representatie sample and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ahmedx
Super User
Super User

Is this what you are looking for?

Screenshot_1.png

Anonymous
Not applicable

Yes, that what I am looking for. I was able to get a simliar result through changing the three-letter aspect into a four-letter one briefly and then reverting once the columns were split.

pls try this

Screenshot_2.png

amitchandak
Super User
Super User

@Anonymous , I power query use Split by position, multiple times with 3,4,4 and the create columns. If needed append them again

https://learn.microsoft.com/en-us/power-query/split-columns-positions

 

For visual you can also consider this approach after splitting and combine 

 

Power BI- Text Part slicer to filter/search text - https://youtu.be/MKKWeOqFG4c
https://medium.com/@amitchandak/power-bi-search-text-parts-in-text-ad2f9783ffa2

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.