Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
pawel_lyszczarz
Frequent Visitor

Data references

Hello, I'm looking for a way to combine data references. I've got data as shown below where A references B, B->C and C->D.
I want to convert that so I know that A has references B,C and D.


Data:

AB
BC
CD


Expected result:

AB,C,D
BC,D
CD

 

I was able to do that with Excel's  "Filter" and "Textjoin" formulas and create a new query based on the previous one, but that's a workaround far from ideal.

P.S That's my first post in here so not sure if the title is correct.

3 REPLIES 3
ImkeF
Super User
Super User

Hi @pawel_lyszczarz ,
indeed, self-references are not supported with my function.
But what you could do is to filter our any self-referencing rows before you apply the function.
Then, add them back in by a simple merge/join.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

TomMartens
Super User
Super User

Hey @pawel_lyszczarz ,

 

@ImkeF has a funtion that creates a path, basically that is what you are looking. The first column contains the parent node, and the second column contains the child node. I assume you have to adapt your table in the way that A also appears in the second column without a value in the parent node column.

 

You can find the function here: https://www.thebiccountant.com/2019/10/03/parent-child-hierarchies-with-multiple-parents-in-power-bi...

After applying the function, you can remove the unwanted column and replace the "|" with a ",".

 

Hopefully this helps to tackle your challenge.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Seems like using that function creates an endless loop. That's probably because my data looks more like this:

Data:

AA
AB
BB
BC
CC
CD
DD


Expected result:

AA,B,C,D
BB,C,D
CC, D

 

So there's a data where A is both Parent and Child. Any idea how to modify so the loop would work properly?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.