Forum Discussion

Oros's avatar
Oros
Post Prodigy
4 years ago
Solved

Relating different tables

Hello,

 

Would anybody know how to build this results table below using the product discount, customer and sales tables?  How do you relate these 3 tables and what formula/statement to use?  Thanks.

 

RESULTS TABLE

Customer#Discount LevelProduct #Special Price
Cust 1BronzeB1$30
Cust 1BronzeB3$5
Cust 2GoldB2$100
Cust 2GoldB1$10
Cust 3SilverB3$3



PRODUCT DISCOUNT TABLE

Product #Discount LevelSpecial Price
B1Bronze$30
B1Silver$20
B1Gold$10
B2Bronze $150
B2Silver$125
B2Gold$100
B3Bronze$5
B3Silver$3
B3Gold$1

 

CUSTOMER TABLE

Customer Discount Type
Cust 1Bronze
Cust 2Gold
Cust 3Silver

 

SALES TABLE

CustomerProduct #
Cust 1B1
Cust 1B3
Cust 2B1
Cust 2B2
Cust 3B3

5 Replies

  • Hi,

    Merge Table 2 into Table 3 based on the Customer column to bring over the Discount type column into Table 3.  Merge Table 3 into Table 1 based on the Product # and Discount type column to bring over the Customer in Table 1.  Now build all your visuals from Table 1.

    Hope this helps.

    • Oros's avatar
      Oros
      Post Prodigy

      Hi Ashish_Mathur ,

       

      Thank you for your quick reply.  In merging table 3 into table 1, what do you mean by based on Product # AND Discount Type column?  How do you achieve this merging using in a query, based on 2 columns? Thanks again.

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Super User

        Hi,

        In the Query Editor, select Merge queries and then select the common columns of both tables.