Forum Discussion

Aaron_Borns's avatar
Aaron_Borns
Frequent Visitor
9 years ago
Solved

Indirect Relationship Needed

I have three tables with two relationships in a DirectQuery .pbix:

Active	From: Table (Column)	To: Table (Column)	Cardinality		Cross filter direction
TRUE Table3 (id) Table2 (id) Many to One (*:1) Single
TRUE Table1 (id) Table2 (id) Many to One (*:1) Single

Here are the columns of interest for each table:

Table	Column		Data Type
Table1 id Whole Number
Table1 model Text

Table2 id Whole Number
Table2 product_line Text

Table3 id Whole Number
Table3 item Text

How do I create a table visualization of Table3 items that are sliced by Table1 models?

 

Considerations:

Thank you!

  • This solution is even more brilliant. No messing with the relationship modeling, I just added this measure to the table visualization and let DAX do the rest. I go the inspiration from this article by Marco Russo.

     

    use_cases = COUNTX(table3,
    CALCULATE(VALUES(table1[id]),
    FILTER(table1,
    table1[id] = table3[id]
    )
    )
    )

    Hope this helps someone.

3 Replies

  • Aaron_Borns's avatar
    Aaron_Borns
    Frequent Visitor

    This solution is even more brilliant. No messing with the relationship modeling, I just added this measure to the table visualization and let DAX do the rest. I go the inspiration from this article by Marco Russo.

     

    use_cases = COUNTX(table3,
    CALCULATE(VALUES(table1[id]),
    FILTER(table1,
    table1[id] = table3[id]
    )
    )
    )

    Hope this helps someone.

    • Anonymous's avatar
      Anonymous
      Not applicable

      This solution worked really well, thank you

  • Aaron_Borns's avatar
    Aaron_Borns
    Frequent Visitor

    Came to a solution after finding this article from Microsoft. I also recommend this article by sqlbi.com.

     

    First I turned on bi-directional filtering, which is currently a Preview Feature in BI Desktop found under Options.

    Then I made the table1:table2 relationship cross filter in both directions.

     

    Although this solution is not exactly what I wanted because now my slicers are bi-directionally filtered, it gets me more than halfway.