Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
philongxpct
Frequent Visitor

Combine different columns from excels files!

             I have a nested tables (3 Columns: Name - Excel file's name; Combined - What columns to keep; D - workbook table). Ends users will type what columns to keep (mess columns per file :<) that my case. So, I want to select these columns dynamicly way.

1.jpg2.jpg

             I try to play around with my data via this approach: https://bondarenkoivan.wordpress.com/2016/01/25/rename-columns-of-nested-tables-in-power-query/ but hard to rename columns cos so many dulicate columns.

             Now i trying to transforms "Table" columns before expand it base on same next rows content "Combine": = Table.TransformColumns(Custom1, {{"D", each Table.SelectColumns("D",[Combined],[Combine])}})

            So, yeah that error i face off. Anyone can help pls.

P/s: Sorry cos my english :<<.

1 ACCEPTED SOLUTION

My suggestion would be to add a Custom Column with formula:

 

= Table.SelectColumns([D],Text.Split([Combined],","))

Next you can remove column D.

 

Specializing in Power Query Formula Language (M)

View solution in original post

2 REPLIES 2
philongxpct
Frequent Visitor

Update:

                Just play around with https://bondarenkoivan.wordpress.com/2016/12/12/transform-column-using-custom-function-in-power-quer...

                My code here:

Custom2 = Table.FromRecords(Table.TransformRows(Custom1),
                      (ref)=> Record.TransformFields(ref,
                                    {"D", each Table.SelectColumns(ref[D],ref[Combine],ref[Combine])}))

                And new error:

Expression.Error: 1 arguments were passed to a function which expects 2.
Details:
Pattern=
Arguments=List

 

                Still play around, any help is appricicated. Thanks

 

 

Happy querying guys ^^!

My suggestion would be to add a Custom Column with formula:

 

= Table.SelectColumns([D],Text.Split([Combined],","))

Next you can remove column D.

 

Specializing in Power Query Formula Language (M)

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.