0

(edited, I solved problem so wanted to tell others how)

Problem: Say you have: Item A. It can contain List of Item B, Item C, Item D. Each of these items also have a list of items themselves. Example, Item B has Item E, Item F. This can continue for any level deep for any of the items.

Additionally Items can have Things. Say Item A (still has other sub items) has a list of Things; Thing A, Thing B, Thing C. Thing C might have Thing D, E, L. Things have same self referential relationship as Items and Items have a list of Things.

Confused yet? lol

The problem with displaying the data in Power BI is based on my research, I have found it to not support self referential relationships in the model view. If I decided to import the entire data structure then it would collapse it and require to be manually expanded for each list and record. This is not preferable given the structure.

I messed around with M but iterating through root then recursively expanding columns sound simple but was not as much. This would potentially have worked but is more complicated than it needed to be.

Solution:

After much learning and experimenting I landed on simple solution to the aforementioned type of problem. Before data is imported in Power BI, flatten it, use DAX to create any relationships you need to display in hierarchy. By flattening I mean just recurs through it and get as flat dictionary or list. You can google this. As for setting up the DAX relations and hierarchy display with matrix visual, checkout this great tutorial. Also I have found this can work with decomp trees as well, and if you don't have an amount field then just use the count of rows in the hierarchy.

Paulson
  • 1
  • 1

0 Answers0