Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
"Data1" is a source file that contains over 40 columns
I have created code that dynamically retrieves 2 columns (in a step called "Table1)
Columns are [Stage] [Invoice]
Second step retrieves 4 columns (in a step called "Table2")
Columns are [1/09/2022] [1/10/2022] [1/11/2022] [1/12/2022]
Both steps only contains 1 row (for this scenario)
I now want to create a step that merges the columns from Step "Table1" and "Table2"
I also created 2 lists which stores the column names I require
The problem is that my attempt brings them together but gives me two rows.
I tried to use M code "= Table.SelectColumns(Table1,List1)&Table.SelectColumns(Table2,List)"
Output looks like this
Stage | Invoice | 1/09/2022 | 1/10/2022 | 1/11/2022 | 1/12/2022 |
First | B2348-B | null | null | null | null |
null | null | 23.54 | 65.76 | 87.23 | 12.54 |
but should be this
Stage | Invoice | 1/09/2022 | 1/10/2022 | 1/11/2022 | 1/12/2022 |
First | B2348-B | 23.54 | 65.76 | 87.23 | 12.54 |
Hope I explained this enough
thankyou
Frank
Solved! Go to Solution.
Use this
=Table.FromColumns(Table.ToColumns(Table.SelectColumns(Table1,List1))&Table.ToColumns(Table.SelectColumns(Table2,List)), List1&List)
👍 It's been a pleasure to help you | Help Hours: 11 AM to 9 PM (UTC+05:30)
How to get your questions answered quickly -- How to provide sample data
if these two table come from same soure, try this
=Table.SelectColumns(Data1,list1&list2)
if these two table come from same soure, try this
=Table.SelectColumns(Data1,list1&list2)
Use this
=Table.FromColumns(Table.ToColumns(Table.SelectColumns(Table1,List1))&Table.ToColumns(Table.SelectColumns(Table2,List)), List1&List)
👍 It's been a pleasure to help you | Help Hours: 11 AM to 9 PM (UTC+05:30)
How to get your questions answered quickly -- How to provide sample data
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
8 | |
6 | |
6 | |
6 | |
5 |
User | Count |
---|---|
9 | |
9 | |
8 | |
6 | |
6 |