Forum Discussion
rp2022
1 year agoHelper II
Getting all child values for every parent value based on a column
I have this data : Parent Child Type 1 3 E 2 102 F 3 5 F 3 4 E 4 6 E 7 170 F 8 9 E 9 10 E 10 11 E 11 110 F 12 120 F 13 14 E 14 1...
- 1 year ago
Akash_Varuna
1 year agoSuper User
Hi rp2022 I think you could add a function to fetch all child values recursively, starting from the given parent, and combine the results for hierarchical relationships.Something like this
(GetChildren as function) =>
let
GetChildren = (ParentID as text, DataTable as table) =>
let
DirectChildren = Table.SelectRows(DataTable, each [Parent] = ParentID),
FurtherChildren = Table.Combine(
List.Transform(
DirectChildren[Child],
each @GetChildren(_, DataTable)
)
),
Result = Table.Combine({DirectChildren, FurtherChildren})
in
Result
in
GetChildren
rp2022
1 year agoHelper II
Akash_Varuna : Thank you for taking the time to help me out. So, the filter will be in a visual and not on the dataset itself. If in the slicer the user selected "8" for instance, they need to see all the lines:
| 8 | 9 | E |
| 9 | 10 | E |
| 10 | 11 | E |
| 11 | 110 | F |