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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
dmcbrier
New Member

Removing the leading comma and space from the string.

 

I am using the Excel ( Query Editor)  which uses the power query language.

 

Here is my challenge.    I have a column that has data as follows:

Column Name is "Name"

 

Data in the Column

, David, Will, Bill

, John, Joe

David, Hillary

John, Billy

, Bill, Harry

Bill

 

The ones that begin with a comma how would I go about removing the leading "comma" and "space" from the string.   Thank you very much.   I do not want to remove the other commas in the middle of the string.     Thank you very much.

1 ACCEPTED SOLUTION
v-micsh-msft
Microsoft Employee
Microsoft Employee

 Hi @dmcbrier,

 

If all the rows contain the ", ", then we could take use of split column(By number of Characters), then delete the ", " part.

 

If the name column contains row that are without the ", " heading, then we could add a custom column, with the following function:

Text.TrimStart

to remove the ", " head string.

 

For example:

26.PNG27.PNG

 

After the custom column added, you may choose to delete the original column in Advanced Editor.

 

Regards,

Michael

View solution in original post

5 REPLIES 5
Beehive
Frequent Visitor

I have followed the suggested solution below but I am receiving an error.  My issue is slightly different, I am trying to remove the characters "0-" when ever they occur at the front of values in a column.

 

When I try the formula with only "0" it will remove the leading zero, when I try with "0-" the words error are displayed in the column.

 

I would appreciate any suggestions to fix please.

 

 

v-micsh-msft
Microsoft Employee
Microsoft Employee

 Hi @dmcbrier,

 

If all the rows contain the ", ", then we could take use of split column(By number of Characters), then delete the ", " part.

 

If the name column contains row that are without the ", " heading, then we could add a custom column, with the following function:

Text.TrimStart

to remove the ", " head string.

 

For example:

26.PNG27.PNG

 

After the custom column added, you may choose to delete the original column in Advanced Editor.

 

Regards,

Michael

Anonymous
Not applicable

Hello, I just tried this as I have a similar situation just at the end so I used TrimEnd with the same column formula shown. Unfortunately it does not work:

KrisLief_0-1659973169879.png

 

KrisLief_2-1659973254820.png

 

KrisLief_1-1659973217263.png

What am I doing wrong?



Anonymous
Not applicable

Hi, Can we combine two values here? For example I want to trim all leading "," and ",," because I have values beginning with comma and other with two commas.

Michael,

 

Thank you very much for the time and effort.   This worked absolutely brilliantly. Cheers!

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.