Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Relating 2 Fact Tables Together

Hello,

I have two datasets: A store inventory table, and a Warehouse (DC) inventory table (I belive they would be called Fact Tables?). Each store is associated with a specific warehouse, and I created a table that links the stores to their respective DC. I don't know how to link the Store table to the DC table, though. 

 

For example, I want to see inventory for a specific product at any given store, and its corresponding DC all in 1 table. I don't know how to properly go about doing this.

 

I linked my sample data to this post below. Thanks in advance!

 

https://1drv.ms/u/s!AmOKQTJU9UwIogIVygSNlyRW4uoy?e=Uboc2g

  • One way of linking the tables is using dimension tables such as:

    where 

     

     

    Dim DC = 
    VAR DC = DISTINCT('Store - DC'[DC])
    VAR DCData = DISTINCT('DC Data'[DC])
    RETURN
    DISTINCT(UNION(DC, DCData))
    Dim Product = 
    VAR DCProdcut = DISTINCT('DC Data'[Product])
    VAR SDProduct = DISTINCT('Store Data'[Product])
    RETURN
    DISTINCT(UNION(DCProdcut, SDProduct))

     

     

     

    I've attached the sample PBIX file

2 Replies

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    One way of linking the tables is using dimension tables such as:

    where 

     

     

    Dim DC = 
    VAR DC = DISTINCT('Store - DC'[DC])
    VAR DCData = DISTINCT('DC Data'[DC])
    RETURN
    DISTINCT(UNION(DC, DCData))
    Dim Product = 
    VAR DCProdcut = DISTINCT('DC Data'[Product])
    VAR SDProduct = DISTINCT('Store Data'[Product])
    RETURN
    DISTINCT(UNION(DCProdcut, SDProduct))

     

     

     

    I've attached the sample PBIX file

    • Anonymous's avatar
      Anonymous
      Not applicable

      PaulDBrown Thank you Paul! This worked perfectly. How can I learn more about relationships like this? I'm just starting to learn about the Star Schema and using dimension tables, but it's not very clear yet.