Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have two fields that I wish to merge into one. However I would like the second field to appear at a end to the first field. The issue is the first field is variable in length. So here is my data.
| Item | Records |
| 1. Item | 221/259 |
| 2. Item Brown | 218/259 |
| 3. Item Red | 7/8 |
| 4. Item No colour | 2/4 |
| 5. Item White | 8/24 |
I would like it to appear like this.
How do I make the lengh of the item field a standard size (longer) so that the merge appends to the end of the Item field? So the opposite of trimming the field I want to add spaces at the end of the Item Field.
Solved! Go to Solution.
Hi @STIBBS_807 ,
Here is my solution, which only displays properly in i.e. notepad:
And this is how it looks like in Power Query:
Here the code in Power Query M that you can paste into the advanced editor (if you do not know, how to exactly do this, please check out this quick walkthrough)
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUjDUU/AsSc1V0lEyMjLUNzK1VIrVAQobQYQVnIryy/NAkoYWCEljqGRQagpQylzfAiJsAhX2y1dIzs/JLy0C6dM3gUiaQiXDMzJLUoESQOOAMrEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Item = _t, Records = _t]),
#"Added Custom1" = Table.AddColumn(Source, "ItemColumnLength", each Text.Length([Item])),
#"Changed Type" = Table.TransformColumnTypes(#"Added Custom1",{{"ItemColumnLength", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each [Item] & " " & Text.Repeat(" ", (List.Max(#"Changed Type"[ItemColumnLength] ) -[ItemColumnLength] )) & [Records]),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"ItemColumnLength"})
in
#"Removed Columns"
Does this solve your issue? 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
| Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
| Also happily accepting Kudos 🙂 |
| Feel free to connect with me on LinkedIn! | |
| #proudtobeasuperuser | |
I replaced the spaces with a period and a space to make it look like a title page.
try use the function
Text.PadEnd(text as nullable text, count as number, optional character as nullable text) as nullable text
Hi @STIBBS_807 ,
Here is my solution, which only displays properly in i.e. notepad:
And this is how it looks like in Power Query:
Here the code in Power Query M that you can paste into the advanced editor (if you do not know, how to exactly do this, please check out this quick walkthrough)
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUjDUU/AsSc1V0lEyMjLUNzK1VIrVAQobQYQVnIryy/NAkoYWCEljqGRQagpQylzfAiJsAhX2y1dIzs/JLy0C6dM3gUiaQiXDMzJLUoESQOOAMrEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Item = _t, Records = _t]),
#"Added Custom1" = Table.AddColumn(Source, "ItemColumnLength", each Text.Length([Item])),
#"Changed Type" = Table.TransformColumnTypes(#"Added Custom1",{{"ItemColumnLength", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each [Item] & " " & Text.Repeat(" ", (List.Max(#"Changed Type"[ItemColumnLength] ) -[ItemColumnLength] )) & [Records]),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"ItemColumnLength"})
in
#"Removed Columns"
Does this solve your issue? 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
| Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
| Also happily accepting Kudos 🙂 |
| Feel free to connect with me on LinkedIn! | |
| #proudtobeasuperuser | |
I like @tackytechtom solution. Just be aware it works well with a mono-spaced font like Courier, but may not work in a font like Arial that has kerning.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingCheck out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 19 | |
| 14 | |
| 12 | |
| 10 | |
| 8 |