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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
madji
Helper I
Helper I

loading

I am new in PW BI,

Could you help me? 

 

For exemple ( simple) I have 2 tables loading:

 

1.

 

AB
11
22
33

 

2.

AD
25
36
47

 

I try to get tables 3 in script: 

 

AC ( B and D)
11
22
25
33
36
47

 

How can I get it? 

 

Thanks!

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee

@madji

You could either try PowerQuery or DAX, see below sample and attached pbix file.

let
    SelectAndRenameColumnsFromTable1 = Table.RenameColumns(Table.SelectColumns(Table1,{"A","B"}),{"B","C"}),
    SelectAndRenameColumnsFromTable2 = Table.RenameColumns(Table.SelectColumns(Table2,{"A","D"}),{"D","C"}),
    CombineAboutTwo = Table.Combine({SelectAndRenameColumnsFromTable1,SelectAndRenameColumnsFromTable2})
in
    CombineAboutTwo
combinedTableInDax =
UNION (
    SELECTCOLUMNS ( Table1, "A", Table1[A], "C", Table1[B] ),
    SELECTCOLUMNS ( Table2, "A", Table2[A], "C", Table2[D] )
)

 

View solution in original post

3 REPLIES 3
Eric_Zhang
Microsoft Employee
Microsoft Employee

@madji

You could either try PowerQuery or DAX, see below sample and attached pbix file.

let
    SelectAndRenameColumnsFromTable1 = Table.RenameColumns(Table.SelectColumns(Table1,{"A","B"}),{"B","C"}),
    SelectAndRenameColumnsFromTable2 = Table.RenameColumns(Table.SelectColumns(Table2,{"A","D"}),{"D","C"}),
    CombineAboutTwo = Table.Combine({SelectAndRenameColumnsFromTable1,SelectAndRenameColumnsFromTable2})
in
    CombineAboutTwo
combinedTableInDax =
UNION (
    SELECTCOLUMNS ( Table1, "A", Table1[A], "C", Table1[B] ),
    SELECTCOLUMNS ( Table2, "A", Table2[A], "C", Table2[D] )
)

 

@Eric_Zhang

Thanks,

But If I have in first table - 6 columns and in second table - 8


6 columns are similar.

 

Are there working for only two columns?

Eric_Zhang
Microsoft Employee
Microsoft Employee


@madji wrote:

@Eric_Zhang

Thanks,

But If I have in first table - 6 columns and in second table - 8


6 columns are similar.

 

Are there working for only two columns?


@madji

You can just add more colulmns in the SELECT columns in my previous post.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.