cancel
Showing results for
Did you mean:
Highlighted
Regular Visitor

creating table from multiple other columns

hi ,

i added a pic that im trying to do in power bi but not succeed,

hope you understand 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User I

Re: creating table from multiple other columns

Hit the New Table button and add this DAX formula:

```new table = ADDCOLUMNS(
NATURALINNERJOIN(
'Table 1',
SUMMARIZE(
'Table 2',
'Table 2'[closing balance]
)
),
"sum balance",
'Table 1'[opening balance] + 'Table 2'[closing balance]
)```

Note that you need to have a relationship between the two source tables. Also if your real data is not quite like this sample data, you may have to use NATURALLEFTOUTERJOIN instead. Depends on whether or not one of the two tables has blanks or duplicates.

Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

5 REPLIES 5
Highlighted
Super User I

Re: creating table from multiple other columns

Hit the New Table button and add this DAX formula:

```new table = ADDCOLUMNS(
NATURALINNERJOIN(
'Table 1',
SUMMARIZE(
'Table 2',
'Table 2'[closing balance]
)
),
"sum balance",
'Table 1'[opening balance] + 'Table 2'[closing balance]
)```

Note that you need to have a relationship between the two source tables. Also if your real data is not quite like this sample data, you may have to use NATURALLEFTOUTERJOIN instead. Depends on whether or not one of the two tables has blanks or duplicates.

Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Highlighted

Re: creating table from multiple other columns

So where is the "New Table" button?

Highlighted
Super User I

Re: creating table from multiple other columns

@efglynnUnder the Modeling tab in the ribbon.

Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Highlighted
Community Champion

Re: creating table from multiple other columns

Frankly I'm surprised @KHorseman offered a DAX solution maybe because this was last year

I think the Query Editor is made for this!

Look at these 2 links describing all the joins and select which one you need in your case

http://www.excelguru.ca/blog/2015/12/16/merge-tables-using-outer-joins-in-power-query/

http://www.excelguru.ca/blog/2015/12/23/merge-tables-using-inner-and-anti-joins-in-power-query/

Once you know which join type you need its really easy to do in the Query Editor

Highlighted
Regular Visitor

Re: creating table from multiple other columns

Amazing!! THX

Announcements

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.

Top Solution Authors
Top Kudoed Authors