Forum Discussion

Niels_NL's avatar
Niels_NL
Advocate I
10 years ago

Merge two tables into one

Hey guys,

 

so I've got two tables now:

  • Customers
    • CustomerID
    • CustomerName
    • Locationdata
    • Businessdata
  • Marketingpreferences
    • CustomerID
    • CustomerName
    • Marketingpreference1
    • Marketingpreference2
    • Marketingpreference3
    • MarketingpreferenceX

I've got 6000 customers in the 'Customers'-table. In the 'Marketingpreferences'-table, only 3000 customers are used, because not every customer has been contacted.

 

What I would like to have is 1 table of customers with all their marketingpreferences.

So i.e.: all 6000 customers and their marketingpreferences; if a customer hasn't been contacted yet and thus has no marketingdata yet available, its value for the particular marketingpreference-column should be empty.

 

How can I make this happen?

Either with the Query Editor or via any other way is okay.

 

Thanks.

~ Niels

 

7 Replies

  • ankitpatira's avatar
    ankitpatira
    Community Champion

    Niels_NL In power bi desktop, edit queries, merge queries, select your tables, choose customer id and left outer join. This will merge customers table with marketing where there is matching customer id.

     

     

     

    • Niels_NL's avatar
      Niels_NL
      Advocate I

      Thanks for your answer ankitpatira, but this still leaves me with a Marketing-table consisting out of 3000 customers. Whereas I wanted a Marketing-table with 6000 customers, where customers with no marketing-information available would just have empty row-values, except for the customerID.

       

       

      Example of my situation:

       

      Marketing-table:

      Customer-table:

       

       

      And this is the table that I would like to have (*NULL* = empty values):

      • ankitpatira's avatar
        ankitpatira
        Community Champion
        Niels_NL in that case you select marketing table then click merge queries and merge it with customers table using customer id and left join.