Forum Discussion
Asina
3 years agoHelper III
Finding paths connected through a node. Data filtering
I have a table which resembles the below. The columns explained: Main contains the name and the pathway number. The Main can therefore contain nodes called Str1 or Str2, which indicates where it...
- 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] ) ) ) ) )
Asina
3 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
johnt75
3 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 🙂