Forum Discussion
Finding paths connected through a node. Data filtering
- 3 years ago
Try
Connected Mains = VAR InitialNodes = UNION( VALUES( 'Table'[Str1] ), VALUES( 'Table'[Str2] ) ) VAR ConnectedMains = CALCULATETABLE( VALUES( 'Table'[Main] ), 'Table'[Str1] IN InitialNodes || 'Table'[Str2] IN InitialNodes, REMOVEFILTERS( 'Table' ) ) VAR ConnectedMainsExlcudingCurrent = EXCEPT( ConnectedMains, { SELECTEDVALUE( 'Table'[Main] ) } ) VAR Result = CONCATENATEX( ConnectedMainsExlcudingCurrent, 'Table'[Main], ", " ) RETURN Result - 3 years ago
If I understand correctly you want a list of mains and all the nodes they are connected to. You could do another table like
Main All Connected = GENERATE ( ALLNOBLANKROW ( 'Main Neighbours'[Radialnr-rettet] ), DISTINCT ( UNION ( CALCULATETABLE ( VALUES ( 'Main Neighbours'[Connected To] ) ), CALCULATETABLE ( VALUES ( 'Main Neighbours'[Neighbours Neighbour] ) ) ) ) )
Try
Connected Mains =
VAR InitialNodes =
UNION( VALUES( 'Table'[Str1] ), VALUES( 'Table'[Str2] ) )
VAR ConnectedMains =
CALCULATETABLE(
VALUES( 'Table'[Main] ),
'Table'[Str1] IN InitialNodes
|| 'Table'[Str2] IN InitialNodes,
REMOVEFILTERS( 'Table' )
)
VAR ConnectedMainsExlcudingCurrent =
EXCEPT( ConnectedMains, { SELECTEDVALUE( 'Table'[Main] ) } )
VAR Result =
CONCATENATEX(
ConnectedMainsExlcudingCurrent,
'Table'[Main],
", "
)
RETURN
Result- Asina3 years agoHelper III
Hi johnt75
Thank you for replying.
You are on the right track, however not quite there yet.
Using the above mentioned code gives me the entire list of Main, not the ones that the selected Main is connected to.
So to check what I mean..you can increase the row of the table above by 3 and call the new Main Ras20 then make a new path that has no values in Str1 and Str2 that is the same as the rows above.
You will see that the code gives you still the Main that is not even connected to it.
- Asina3 years agoHelper III
Hi johnt75
I have a followup issue, which I cannot seem to solve.
The above solution you provided gives me the "Neighbors" of the Main, however when I want the Neighbors-Neighbor, I just put the Main in a new table or matrix and get the Neighbors-Neighbor. This is viable but not practical.
However, in this method I will have to make 3 tables just to show these information, and I only have the choice to click on Neighbors-Neighbor which filters the picture, yet I have no choice in having Neighbor table to show me the picture.
Is there a way to collate them all into 1 view or 1 table/matrix and each Main is separately clickable.
I have a picture you can see what I mean.Is the filter collider a good idea to see the Neighbors-neighbor?
however at the moment it shows the previous chosen Main:
- johnt753 years agoSuper User
No idea if this will work but these are my thoughts, for what they're worth.
You could try creating a field parameter which includes columns from Main, Main's neighbour and Neighbour's neighbour. Put the field parameter on each of the slicers, and set a filter on the field parameter in each slicer, so each one shows a different column.
On the chart, also use the field parameter as the value. I'm hoping that when you select one of the values from the slicer that selection, along with the field parameter filter, will get applied to the chart and show the correct info.
- Asina3 years agoHelper III
Thanks for answering, however I am not sure I fully get what you mean.. Do you have an example?
Also is there a way to fix the following where the Mains Neighbor shows a comma between the Main, since it is not filterable. I know some nodes might have many connections to other Mains, but is there a way to show only 1 Neighbor per row, but make the row duplicate itself if more than 1 connection is spotted as to avoid the comma issue? See picture below.