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] ) ) ) ) )
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.
I can't replicate the problem.
- Asina3 years agoHelper III
I am getting 1 line where all the Main values are written, instead of only the ones connected to the current Main.
see the picture- johnt753 years agoSuper User
Are you adding the code as a new column or a new measure? It is supposed to be a measure.
- Asina3 years agoHelper III
as a new column...Thats why it was giving me wrong output. Now i put it as measure and it works nicely 🙂 thank you again.
As always when you appear in my post, I know a solution is due 🙂