Forum Discussion

medlalami's avatar
medlalami
Helper I
5 years ago
Solved

Relationship between two tables

Hi all,

 

I created a relation between two tables (Problems and Data), for the following fields : Priority - Urgency - Status

The relation is Many-To-One for all fields.

Now when I want to create my Clustered bar chart in my page and wants to display the number of the Problems as values, against the Priority (the field coming from Data table), I got nothing :

But when I use the Priority field from Problems table, I got the correct result with the total for each priority.

I'm new with Power BI, so maybe I forget something important.

  • Hi medlalami,

     

    You need to create a measure by using  "USERELATIONSHIP" with the calculation function in dax to turn inactive relationships into active relationship.

     

    Refer 

    https://www.sqlbi.com/articles/using-userelationship-in-dax/

     

     

    Appreciate a Kudos! ๐Ÿ™‚
    If this helps and resolves the issue, please mark it as a Solution! ๐Ÿ™‚

    Regards,
    N V Durga Prasad

10 Replies

  • selimovd's avatar
    selimovd
    Most Valuable Professional

    Hey medlalami ,

     

    which of the 3 relationships is active?

    Can you do a double click on the connection and show us?

     

    Best regards

    Denis

  • nvprasad's avatar
    nvprasad
    Solution Sage

    Hi medlalami,

     

    You need to create a measure by using  "USERELATIONSHIP" with the calculation function in dax to turn inactive relationships into active relationship.

     

    Refer 

    https://www.sqlbi.com/articles/using-userelationship-in-dax/

     

     

    Appreciate a Kudos! ๐Ÿ™‚
    If this helps and resolves the issue, please mark it as a Solution! ๐Ÿ™‚

    Regards,
    N V Durga Prasad

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    If the fields in the โ€œdataโ€ table are related (sets and subsets), you don't actually need three relationships. All you need is the one-to-many relationship with the field with the highest granularity in the tables. You can then use whichever field from the dimension table in measures, visuals, slicers etc...

    so just make sure the relationship is created with the field with the highest granularity.

     

    If the fields are unrelated (independent values) I would recommend you create a separate dimension table for each field.