Concatenate all related records (nodes)

Hi,

I’m trying to generate a text string of all related items of a record/node. Similar to what a path does, but a path keeps its hierarchy while in this case this isn’t possible as their could be “loops” and I’m not that interested in the actual hierarchy itself reflected in the generated string.

So for instance the following:

From To Result
A A-B-C-D-E-F
B A-B-C-D-E-F
C A-B-C-D-E-F
D A-B-C-D-E-F
E A-B-C-D-E-F
A B A-B-C-D-E-F
B C A-B-C-D-E-F
D E A-B-C-D-E-F
F A A-B-C-D-E-F
G G-H-I
H G-H-I
I G-H-I
G H G-H-I
H I G-H-I
J J
K K

In the attached Power BI file you will find sample data and nodes visualizing the relationship between records. The reason why I’m looking for the generated string, is so that you can filter a specific item and see the whole chain of this item. So if you have other ideas to get to the same result, that would be fine of course.

Below an example of a loop in the Power BI file, but I want to be able to pass on any item within this chain and see the whole chain (so all related items, directly & indirectly).

image
edna - nodefilter.pbix (338.7 KB)

Anyone know a solution to this? ) I tried: Parent Child Hierachy - #4 by Nick_M but no luck.

Hi @Wlknsn

I can try…but I didn’t understand the requirement… Could you please provide sample screenshots what is there and what is expecting ?

Child Parent Result (all related combinations)
A A-B-C-D-E-F
B A-B-C-D-E-F
C A-B-C-D-E-F
D A-B-C-D-E-F
E A-B-C-D-E-F
A B A-B-C-D-E-F
B C A-B-C-D-E-F
D E A-B-C-D-E-F
F A A-B-C-D-E-F
G G-H-I
H G-H-I
I G-H-I
G H G-H-I
H I G-H-I
J J
K K

I’ve changed the column names, perhaps this is easier? So similar to path, I’m looking for the hierarchy but as I have circular dependencies, path cannot be used. I’m looking for something that can simply concatenated all related (unique) items.

@Wlknsn

E is the parent of D…How E and D comes to this chain…

image

image

The point is, all of these are relationships towards each other. I can display this nicely in a network graph, a custom one based on the Social Netwok Graph (forked from its code), but what I’m mostly interested in, is the filter. So that I can see the whole cluster for example where “A” fits in, or “E” (the same), …

A path would be ideal, but not possible.

Potentially, a dirty solution would be a way to create a function that loops a predefined set of amount of times. For example: something that lookups all the parents, then the parents of the parents, … for X amount of times and then a concatenation of all unique items.

Best of course would be that it stops when it finds a value that it already found earlier.

@Wlknsn
Sorry I didn’t understand how D is related to C…

You’re right, that connection is missing, so basically you have in the case above the following cluster (because I missed a few lines)

A-B-C-F (is loop)
D-E

But imagine you also had as a connection:
D → C

As a workaround, would it be possible to have a function lookup the parents. The result should be a table as there could be multiple. Then you run that same function again based on expanded table of the previous results. And this up to X times (let’s say 5). The final result should then concatenate all the results and you should have something similar?

Just don’t know exactly how to do this in a function.

@Wlknsn

Please provide the correct data and expected result output

Child Parent Result (all related combinations)
A A-B-C-D-E-F
B A-B-C-D-E-F
C A-B-C-D-E-F
D A-B-C-D-E-F
E A-B-C-D-E-F
A B A-B-C-D-E-F
B C A-B-C-D-E-F
C D A-B-C-D-E-F
D E A-B-C-D-E-F
E F A-B-C-D-E-F
F A A-B-C-D-E-F
G G-H-I
H G-H-I
I G-H-I
G H G-H-I
H I G-H-I
J J
K K

That remains 100% the same (added the two missing lines).

So this results in 4 different clusters:

  • A-B-C-D-E-F
  • G -H-I
  • J
  • K

So that if I filter on “E” in the results column, I get all records where E is contained in the cluster and so the full cluster. That’s the goal.

@Rajesh ?

@Wlknsn

I tried but no luck…

image

We can’t use Path function here because parent is blank for some rows… and also looping A-B-C-D-E-F-A

We need to find a different pattern here… I need some time to work on this…Currently I’m busy with some other work…

Let’s wait others to respond on this…

Bumping this post for more visibility.

Hi @Wlknsn,

You could try this.
Based on Imke Feldmann’s BOM explosion function create a list with all combinations.

From that list retrieve the final string that contains the [Child] item
With this result.

Here’s your sample file.
eDNA - All Combinations.pbix (14.7 KB)

I hope this is helpful.

Hello @Wlknsn, good to see that you are having progress with your inquiry. Did the response above help you solve your inquiry?

If it does, kindly mark as solution the answer that solved your query.

If not, how far did you get and what kind of help you need further?

That would be a nice twist to her solution. I’ve tried to tweak her solution to flatten hierachies as well, but got to a dead end.

I’m going to test this one in the next days, but bear with me, need to set up the old model again. You may have seen in the DAX thread that I’ve received a brilliant solution for non-multiple-parent scenario. The result of this in a custom network graph we’ve build is brilliant. (Will be embedded in D365 forms).

1 Like

Hello @Wlknsn, just following up if you were able to find the solution to your problem? :slight_smile: