Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi,
I have a table with 2 columns: source and target. Sample:
| Source | Target |
| Company | Plant A |
| Company | Plant B |
| Company | Plant C |
| Plant A | Building X |
| Plant A | Building Y |
| Plant B | Building R |
| Plant B | Building S |
I created the column isLeaf to check for leaf nodes (True or False):
IsLeaf =
VAR CurrentNode = FullHierarchy[Target]
RETURN CALCULATE (
COUNTROWS ( FullHierarchy ),
ALL ( FullHierarchy ),
FullHierarchy[Source] = CurrentNode
) = 0Also, the path is calculated using the PATH() function.
Next, I created the disconnected table Leafs containing only the leaf nodes:
Leafs =
SELECTCOLUMNS(
FILTER(FullHierarchy, FullHierarchy[IsLeaf]),
"LeafNode", FullHierarchy[Target]
)This is the result: 2 disconnected tables.
My goal is to have 2 visuals: a slicer based on Leafs and a table based on FullHierarchy. Selecting a leaf shows only the items that are directly or indirectly connected to it (i.e. part of it's path).
The statement to do so would be something like:
PATHCONTAINS(
LOOKUPVALUE(FullHierarchy[Path],
FullHierarchy[Target]
[Selected Node]),
FullHierarchy[Target])The statement above would lookup the path for the selected leaf node, and then check if the node in the table was part of it, to decide whether or not to show it.
I've tried countless of variations, but have unable to implement this. Any ideas, suggestions, etc would be greatly appreciated! Thank you!
Sample pbix file is available here.
Solved! Go to Solution.
Hi, @8a5c4b91-8100-4 ;
You could create a flag measure.
flag =
IF(CONTAINSSTRING(
CALCULATE(MAX('FullHierarchy'[P]),FILTER(ALL(FullHierarchy),PATHCONTAINS([P],MAX('Leafs'[LeafNode])))),
MAX('FullHierarchy'[Target])),1)
Then filter it .
The final result:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @8a5c4b91-8100-4 ;
You could create a flag measure.
flag =
IF(CONTAINSSTRING(
CALCULATE(MAX('FullHierarchy'[P]),FILTER(ALL(FullHierarchy),PATHCONTAINS([P],MAX('Leafs'[LeafNode])))),
MAX('FullHierarchy'[Target])),1)
Then filter it .
The final result:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 56 | |
| 39 | |
| 35 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 73 | |
| 70 | |
| 37 | |
| 35 | |
| 26 |