Forum Discussion
Search in a tree hierarchy visual
Hello janisska,
Can you please try the following:
1. Create a calculated column for the Path
PathColumn = PATH(Table[NodeID], Table[ParentID])
2. Create Measure for Node Search
SelectedNodeSearch =
VAR SelectedNode = SELECTEDVALUE('NodeTable'[NodeName])
RETURN
IF(
CONTAINSSTRING(Table[PathColumn], SelectedNode),
1,
0
)
3. Create Measure for Showing Parent and Child Nodes
ShowRelatedNodes =
IF(
[SelectedNodeSearch] = 1,
1,
0
)
In your Tree visual, add the ShowRelatedNodes measure as a visual-level filter and set it to show only when the value equals 1 (ensures that when a node is selected, the entire hierarchy structure (including parents and children) remains visible.)
Hope this helps.
Hi Sahir_Maharaj, thanks for your reply. I have already tried this with chat gpt (as well as many other solutions), here I get an error with the SelectedNodeSearch.
"A single value for column 'PathColumn' in table 'Table' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."