Forum Discussion

Alessandro70's avatar
Alessandro70
Regular Visitor
1 year ago
Solved

Problem with reletionship

Hi,

 

I have 2 table

1st: (Unique value for column "Account")

Account     Address

Test1           Add1

Test2           Add2

 

2nd: (multiple value for column "Account")

Account     License

Test1          Lic-A

Test1          Lic-B

Test2          Lic-A

Test2          Lic-C

Test3          Lic-A

Test3          Lic-B

Test3          Lic-C

 

I would like select the column "Account" from 1st table a see the value of Licenses on 2nd table 

 

Ex: select "Test2" from 1st table and see the value "Lic-A" and "Lic-C" on 2nd table

 

Many thanks

  • Hi Alessandro70 ,

    To achieve this, you need to establish a one-to-many relationship between your two tables in Power BI. The first table (Account_Address) contains unique Account values, making it ideal to act as a dimension table, while the second table (Account_License) has multiple entries per Account, making it your fact table. Once the relationship is set up, you can use a slicer or filter on the Account column from the first table, and it will automatically filter the second table to show the relevant license values.

    Here’s how to set it up:

    1. Go to Model view in Power BI.

    2. Create a relationship from the Account column in the first table to the Account column in the second table.

      • Make sure it’s a one-to-many relationship:
        Account_Address[Account] (one) → Account_License[Account] (many)

    3. In your report, add a slicer or table using the Account column from the first table.

    4. Then create a table visual showing License from the second table.

    Now, when you select an account (e.g., "Test2") from the first table, Power BI will automatically filter the second table to show "Lic-A" and "Lic-C". Let me know if relationships aren’t working or you need help with inactive ones or DAX alternatives.

4 Replies

  • Deku's avatar
    Deku
    Super User

    If you create a 1 many relationship and pull table1[account] and tables[licence] to a table you will see this. What are looking for specifically? What is the output?

  • Hi Alessandro70 

     

    There are two important steps to make your model work as expected:

    Make sure the "Account" values in the first table (Accounts table) include all the values from the second table (Licenses table).
    Currently, the Accounts table only has "Test1" and "Test2", but the Licenses table also includes "Test3". You'll need to add "Test3" to the Accounts table for the relationship to work properly.

    Create a one-to-many relationship between the tables:

     

    The Accounts table should be the "one" side (unique Account values).

    The Licenses table should be the "many" side (repeated Account values).

    Once the relationship is set correctly, you can easily build a visual to display all Licenses for a selected Account using a slicer or filtering logic.

    More information about relationships in the linked guide :
    https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-create-and-manage-relationships

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

  • Hi Alessandro70 ,

    To achieve this, you need to establish a one-to-many relationship between your two tables in Power BI. The first table (Account_Address) contains unique Account values, making it ideal to act as a dimension table, while the second table (Account_License) has multiple entries per Account, making it your fact table. Once the relationship is set up, you can use a slicer or filter on the Account column from the first table, and it will automatically filter the second table to show the relevant license values.

    Here’s how to set it up:

    1. Go to Model view in Power BI.

    2. Create a relationship from the Account column in the first table to the Account column in the second table.

      • Make sure it’s a one-to-many relationship:
        Account_Address[Account] (one) → Account_License[Account] (many)

    3. In your report, add a slicer or table using the Account column from the first table.

    4. Then create a table visual showing License from the second table.

    Now, when you select an account (e.g., "Test2") from the first table, Power BI will automatically filter the second table to show "Lic-A" and "Lic-C". Let me know if relationships aren’t working or you need help with inactive ones or DAX alternatives.