Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Relate primary key to multiple columns

I have three data tables that look like this:

I have many visuals/charts/tables that center around ItemTable and use ItemTable as a filter.

Right now, I have ItemTable related directly ProblemLog by Item -- so if I filter to A1 from ItemTable, I just see Problem #1. This is a 1:Many relationship (can have multiple problems for one item).

 

The challenge I have is taking into account the ParentChild table. When I filter ItemTable to A1, I'd like to see the Problems for A1 and all of its children. So when filtering for A1, I need to see Problem #1 and Problem #3, because D4 is a child of A1.

 

Does anyone have a thought on how to set up relationships with the ParentChild table?

 

It's almost like I need the relationships set up like this, though I don't think this would actually work since there can only be one active relationship:

 

 

 

  • Anonymous's avatar
    Anonymous
    6 years ago

    Update, solved this, here's the simplified solution for anyone searching in the future:

    I manipulated my ParentChild table to take this format, then was able to relate ItemTable to ParentChild to ProblemLog.

  • Anonymous Check the attached solution.

     

     

    I would 💖 Kudos 🙂 if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

3 Replies

  • Anonymous Check the attached solution.

     

     

    I would 💖 Kudos 🙂 if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi parry2k -- thanks, this is the almost exact approach I used.

      I actually created 4 separate queries for each "child" level and then appended the four together -- using Unpivot is much better! THANK YOU!

  • Anonymous's avatar
    Anonymous
    Not applicable

    Update, solved this, here's the simplified solution for anyone searching in the future:

    I manipulated my ParentChild table to take this format, then was able to relate ItemTable to ParentChild to ProblemLog.