cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Create new table with information from two other tables

I need to create a new table and merge two other tables into this one.

One table contains invoiced information and the other table has current order information.

 

There are some columns that should be merged into the same column as "Customer name", "Item id", "Description" and so on but there are also different information that must go in seperate colums as "Sold qty", Invoiced qty" and so on.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User V
Super User V

Re: Create new table with information from two other tables

Hi @swe_sebastian 

 

You can create your customer table using DAX expression, as an example below.

Customers = 
DISTINCT(
    UNION(
        ALLNOBLANKROW( orders[CustomerKey], orders[Name] ),
        ALLNOBLANKROW( invoices[CustomerKey], invoices[Name] )
    )
)

 Or use Power Query 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

View solution in original post

3 REPLIES 3
Highlighted
Super User V
Super User V

Re: Create new table with information from two other tables

Hi @swe_sebastian 

 

Are you sure, that you want to merge these tables?

There could be a situation where you have two or more invoices per order and vice versa, this situation would potentially create duplicate values.

 

Would it not be easier to keep these tables separate and create dimension tables ( customers, Items ) with relationships to both Invoice and order tables

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

 

New Member

Re: Create new table with information from two other tables

Hi @Mariusz 

 

That is one way to do it.

 

Unfortunately I don't have a table with customer id.

There might be situations where I have customers with open orders and no invoices so they will not be in the invoice table.

 

I would like to be able to have a matrix with invoiced & current orders for the customer and also be able to look into each product.

 

/Sebastian

Highlighted
Super User V
Super User V

Re: Create new table with information from two other tables

Hi @swe_sebastian 

 

You can create your customer table using DAX expression, as an example below.

Customers = 
DISTINCT(
    UNION(
        ALLNOBLANKROW( orders[CustomerKey], orders[Name] ),
        ALLNOBLANKROW( invoices[CustomerKey], invoices[Name] )
    )
)

 Or use Power Query 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

View solution in original post

Helpful resources

Announcements
Meet the 2020 Season 2 Power BI Super Users!

Meet the 2020 Season 2 Power BI Super Users!

Find out who's part of the program this season, and welcome the new Super Users.

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

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

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Featured Data Story of The Month

Featured Data Story of The Month

All Data Stories Gallery contributions are reviewed for each month. We select a contribution and feature the community member the following month.

Power BI Dev Camp - Developing with .NET Core

Power BI Dev Camp - Developing with .NET Core

Learn how to develop custom web applications for Power BI using .NET Core 3.1 and .NET 5.

Top Solution Authors
Top Kudoed Authors