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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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