Forum Discussion

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable
    What does it mean "other way round"? There is no 1-1 correspondence from a relation to its transitive closure, so you can't really do what you require.
  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

    Anonymous maybe this is what you want

    here is the code

    Input = VAR t=
    SELECTCOLUMNS (
        GENERATE (
            GENERATE (
                ADDCOLUMNS (
                    Output,
                    "@path", SUBSTITUTE ( Output[Destinations], ";", "|" ),
                    "@n",
                        LEN ( Output[Destinations] )
                            - LEN ( SUBSTITUTE ( Output[Destinations], ";", "" ) ) + 1
                ),
                GENERATESERIES ( 1, [@n], 1 )
            ),
            ROW ( "To", PATHITEM ( [@path], [Value] ) )
        ),
        "From", [From],
        "To", [To]
    )
    RETURN 
    FILTER(t,VAR fr=[From] VAR tt=[To] RETURN COUNTROWS(FILTER(t,[From]=tt||[To]=fr)))