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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
I have columns values such as the below:
JoeBloggs
TomJones
PeterKay
ChiAuYeung
I need to either add a <space> before each uppercase character (except the first character) or split the column on each uppercase character, is this possible using Power Query (M)?
Thanks.
hi, @Anonymous
You can try to this code in Power Query
let
Source = #table(type table[Enum = text],{{"TomJones"},{"ChiAuYeung"},{"JoeBloggs"},{"PeterKay"} }),
Splitted = Table.TransformColumns(Source, {{"Enum", each Splitter.SplitTextByPositions(Text.PositionOfAny(_,{"A".."Z"},Occurrence.All))(_)}}),
Tabled = Table.TransformColumns(Splitted,{{"Enum", each Table.FromColumns(List.Zip({_}))}}),
ColumnNames = Table.ColumnNames(Table.Combine(Tabled[Enum])),
NewColumnNames = List.Transform(ColumnNames, each "Enum."&Text.Middle(_,6)),
ExpandedEnum = Table.ExpandTableColumn(Tabled, "Enum", ColumnNames, NewColumnNames),
TransformList = List.Transform(NewColumnNames, each {_,type text}),
Typed = Table.TransformColumnTypes(ExpandedEnum, TransformList)
in
TypedResult:
Best Regards,
Lin
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 46 | |
| 42 | |
| 34 | |
| 31 | |
| 21 |
| User | Count |
|---|---|
| 143 | |
| 125 | |
| 100 | |
| 81 | |
| 63 |