Forum Discussion
Is it possible to Trim leading/trailing spaces using transform data?
Using an excel file as my source, there's a column called "Incident" which has the types of incident such as "Physical Assault", "Threatening behaviour", "Throwing an object" & so on. There's 11 different incident types.
If there was more than one incident, then each incident is split up with a comma (e.g. "Physical Assault, Throwing an object").
So I went into Transform Data, used split column ("," as delimiter) & split it into rows so I could put a slicer on a graph, but it's got 2 instances of most incidents.
My thinking is that it's not removed the space from the start/end of any that were delimited.
Is there a way to resolve this without having to go into the excel file, recreating the split column & using TRIM?
Thanks in advance,
G
BassG ,
In Power Query there is a function called Text.Trim.
https://learn.microsoft.com/en-us/powerquery-m/text-trimYou can create a new Custom Column, apply this function to your original column then, if desired, delete the old column.
Hope this helps.
Regards,
3 Replies
- rsbin
Community Champion
BassG ,
In Power Query there is a function called Text.Trim.
https://learn.microsoft.com/en-us/powerquery-m/text-trimYou can create a new Custom Column, apply this function to your original column then, if desired, delete the old column.
Hope this helps.
Regards,
- BassG
Helper I
Thanks rsbin, that worked a treat. 😎
- sarah2
Helper II
A better way to do this is a custom delimeter and make it ", " (comma space)