Forum Discussion
Anonymous
3 years agoNot applicable
Power Query - Split and Trim Text at the same time
Hi, Is it possible to Split a column by a delimiter AND trim the text at the same time? I'm using a parameter and list to split a column dynamically, so the name and number of columns can cha...
- Anonymous3 years ago
Hi JirkaZ ,
Thanks for this. It works on all the text fields, which is great. I've just used the last 2 steps, as I've amended my split to remove the number at the end of the name and use a list value instead:
#"Split Column by Delimiter - Creative" = Table.SplitColumn( #"Split Column by Delimiter - Line Item", "Taxonomy_Creative", Splitter.SplitTextByDelimiter(#"DV360 Creative - Delimiter", QuoteStyle.Csv), List.Transform(#"DV360 Creative - Fields", each Text.From(_))), MyColumns = Table.ColumnNames(#"Split Column by Delimiter - Creative"), Transformation = Table.TransformColumns(#"Split Column by Delimiter - Creative", List.Transform(MyColumns, each{_ , Text.Trim, type text})),But I have 2 date fields and a numerical field in my table. When I add in these steps, these values then show as errors. Is there any way for me to exclude these from the transformation? Or for it to only target text fields?
Thanks,
Mark
wdx223_Daniel
3 years agoCommunity Champion
= Table.SplitColumn(Source, "Taxonomy_Campaign", each List.Transform(Splitter.SplitTextByDelimiter(#"DV360 Campaign Name - Delimiter", QuoteStyle.Csv)(_),Text.Trim), List.Transform({1..List.Count(#"DV360 Campaign Name - Fields")}, each "Campaign Field."&Text.From(_)))