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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Connecting 2 tables question

Hi,

 

i'm hoping this is a straightworward question..

 

I have data across 2 tables and need to track by products/ ALL suppliers etc. My issue is that i have 2 supplier columns for different parts of each product. see tables example below. 

How should I be shaping the data? Do i need to duplcate the first table multiple times or something..etc? Hopefully that's clear..  

 

ProductSupplier1Supplier2Date Due
ApplesH12G2301/01/2022
OrangesH12F3402/01/2022
PearsK32G2303/01/2022

 

 

ProductSupplierDate Delivered
ApplesH1202/02/2022
ApplesG2304/01/2022
OrangesH1203/02/2022
OrangesF3402/02/2022
PearsK3202/02/2022
PearsG2302/02/2022

 

 

many thanks

J

1 ACCEPTED SOLUTION

Hi, @Anonymous 

You can consider using lookupvalue to create a calculated column in the bill table to integrate the data in the other two tables

Date Due =
SWITCH (
    'Bills Table'[Type],
    "Heavy",
        LOOKUPVALUE (
            'Table Heavy Products'[Date Due],
            'Table Heavy Products'[Product], 'Bills Table'[Product]
        ),
    "Light",
        LOOKUPVALUE (
            'Table Light Products'[Date Due],
            'Table Light Products'[Product], 'Bills Table'[Product]
        )
)

124.png

Best Regards,
Community Support Team _ Eason

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Ok Thanks so much, i think i'm making some progress.

 

I'm not sure if this is a completely new question or related to the above. 

 

If i have the 3 tables below and i want to track the 4 products to see if they've arrived, or see which suppliers perform well etc, what is the best way to go about this?

 

Table Heavy Products  
ProductSupplierTypeDate Due
ApplesH12Heavy01/02/2021
OrangesG14Heavy03/01/2021

 

 

Table Light Products  
ProductSupplierTypeDate Due
ApplesH12Light01/02/2021
OrangesH12Light02/01/2021

 

 

Bills Table    
ProductSupplierTypeDate ArrivedCost
ApplesH12Heavy01/02/2021 £             20.00
ApplesH12Light02/01/2021 £             30.00
OrangesH12Heavy03/01/2021 £             20.00
OrangesG14Light  

Hi, @Anonymous 

You can consider using lookupvalue to create a calculated column in the bill table to integrate the data in the other two tables

Date Due =
SWITCH (
    'Bills Table'[Type],
    "Heavy",
        LOOKUPVALUE (
            'Table Heavy Products'[Date Due],
            'Table Heavy Products'[Product], 'Bills Table'[Product]
        ),
    "Light",
        LOOKUPVALUE (
            'Table Light Products'[Date Due],
            'Table Light Products'[Product], 'Bills Table'[Product]
        )
)

124.png

Best Regards,
Community Support Team _ Eason

Anonymous
Not applicable

Thanks @amitchandak 

 

I'll give this a try. 

 

Will the new Product table auto update if new products are added to Table1 after i've made the Product table?

Hi,  @Anonymous 

You can create a Supplier_Product field and create the relationship based on this new field.

122.png

 

But you need to unpivot column"Supplier1" and column “Supplier2” in Table1 first.

Product Date Due Supplier
Apples 1/1/2022 H12
Apples 1/1/2022 G23
Oranges 2/1/2022 H12
Oranges 2/1/2022 F34
Pears 3/1/2022 K32
Pears 3/1/2022 G23

 

109.png

120.png

 

Please check my attached file for more details.

 

Best Regards,
Community Support Team _ Eason

amitchandak
Super User
Super User

@Anonymous , Create common dimension product and supplier and date. join with both tbales

 

example

Product = distinct(union(distinct(Table1[Product]),distinct(Table2[Product]) ))

 

refer

Bridge Table: https://www.youtube.com/watch?v=Bkf35Roman8&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=19

 

 

for date

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.