Forum Discussion

Min_02's avatar
Min_02
Regular Visitor
5 years ago
Solved

Relationships between tables by date

Hi,   I have three 3 tables: Sales1, Sales2 and Calendar Table. I need to link Sales1 and Sales2 by product code, and both Sales1 and Sales2 date columns to date column in Calendar Table.   The p...
  • CNENFRNL's avatar
    CNENFRNL
    5 years ago

    It's inferred from your description that you created a Many to Many relationship between Sale1 and Sale2; it's the last thing in the world of my recommendation even if it's supported by POWER BI! It's at the disposal of data modeling experts. A rule of thumb is to build a One to Many relationship whenever possible.

     

    In your case, I suggest following steps,

    1. extract all unique product code from both Sale1 and Sales to form a dimention table this way,

     

    dim_Product =
    DISTINCT (
        UNION ( VALUES ( Sales1[product code] ), VALUES ( Sales[product code] ) )
    )

     

    •  Relate dim_Product to Sales1 and Sales2 respectively, POWER BI can detect automatically as One to Many;
    • Now it's supposed to succeed in relating Calendar table to Sales1 and Sales2.