Forum Discussion
How to append multiple columns from inside one table
- 6 years ago
Hi apoje
I am not sure why you've completely ignored my solution all along 🤔. It does exactly what you showed in your first post in a simple way. If the base table is "tbl_bundle" in the files you've shared, you can create a blank query with the following M code and you'll get the result. It is the same as I posted a couple of days ago already:
let Source = tbl_bundle, #"Removed Columns" = Table.RemoveColumns(Source,{"SKU-bundleID"}), ExtractColumns_ = Table.ToColumns(#"Removed Columns"), ContentCols_ = List.Combine(List.Alternate(ExtractColumns_,1,1,1)), QuantityCols_ = List.Combine(List.Alternate(ExtractColumns_,1,1,0)), final_ = Table.FromColumns({ContentCols_, QuantityCols_}, {"ContentAll", "QuantityAll"}) in final_Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
HI ibarrau I created a folder on OneDrive and amended the data.
The file where is the code is: invoice-v01
the folder link: https://ipotechnik-my.sharepoint.com/:f:/g/personal/andraz_poje_ipotechnik_de/EueJyvbjKrFFt5RzW5wvobIBlhSu0GyODYP14vXo_INRMw?e=Ai8ZE6
Thank you for the help!
Andraz
Hi apoje
I am not sure why you've completely ignored my solution all along 🤔. It does exactly what you showed in your first post in a simple way. If the base table is "tbl_bundle" in the files you've shared, you can create a blank query with the following M code and you'll get the result. It is the same as I posted a couple of days ago already:
let
Source = tbl_bundle,
#"Removed Columns" = Table.RemoveColumns(Source,{"SKU-bundleID"}),
ExtractColumns_ = Table.ToColumns(#"Removed Columns"),
ContentCols_ = List.Combine(List.Alternate(ExtractColumns_,1,1,1)),
QuantityCols_ = List.Combine(List.Alternate(ExtractColumns_,1,1,0)),
final_ = Table.FromColumns({ContentCols_, QuantityCols_}, {"ContentAll", "QuantityAll"})
in
final_
Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
- LiziM4 years agoFrequent Visitor
SOLVED:
https://community.powerbi.com/t5/Desktop/Appending-columns/m-p/1555845#M635475
Hi AIB,
I have a similar problem, which I've tried to apply your solutions to, but I'm having some issues still.
Currently, I have a table like this:
Job Card ID Artisan 1 Artisan 2 Artisan 3 1 Bradley James 2 Mike Bradley John
I would like to create a table like this (excluding blanks as shown below):
Job Card ID Artisan 1 Bradley 1 James 2 Mike 2 Bradley 2 John So far, I am able to get all the artisans into one column, but I am unsure on how to get the corresponding Job Card ID.
Any help would be much appreciated and I'll be sure to let you know if the solution does/doesn't work!
SOLVED:
https://community.powerbi.com/t5/Desktop/Appending-columns/m-p/1555845#M635475