OpenBI Docs Buy

NETWORK.REACH OpenBI

The nodes reached from flagged ones, and in how many hops.

Group: Networks. OpenBI’s own: DAX has no function of this name.

Syntax

NETWORK.REACH ( <links>, <from>, <to>, <seeds>, <seed> [, <hops>] [, <direction>] )
ParameterTypeDescription
linksTableThe rows that make the network, one link a row: a table of the model or a table expression, as the filters leave it.
fromExpression
evaluated for each row
One end of each row's link, such as a payer, a customer or a place.
toExpression
evaluated for each row
The other end of each row's link.
seedsTableThe flagged rows the spreading starts from, such as FILTER ( Accounts, Accounts[Flagged] ).
seedExpression
evaluated for each row
The node of each row of seeds.
hopsWhole number
optional
How many links away to go at most. Left out, as far as the links lead.
directionText
optional
"out" (when left out) follows each link from its first end to its second, where the money went; "in" goes back to where it came from; "both" takes either way.

Returns

Table. A row a node reached, nearest first, with the columns Node, Hops and Seed.

Remarks

  • The flagged nodes themselves come first, at 0 hops. Hops is the fewest links from the nearest flagged node, and Seed is that node (one of them, on a tie).
  • Only the nodes reached are listed. The links always have a direction here: from to to.
  • Seeds that are not nodes of the network are passed over; when none of them is, the call is an error.
  • For a score rather than a distance, use NETWORK.PROPAGATE.

Compared with DAX

An OpenBI function: DAX has none like it, so a measure or query that uses it works in OpenBI only, not in Power BI or Analysis Services.

Examples

Where the money from D went

EVALUATE
VAR Payments =
    DATATABLE (
        "Payer", STRING, "Payee", STRING, "Amount", INTEGER,
        {
            { "A", "B", 100 }, { "B", "C", 80 }, { "C", "A", 60 }, { "C", "D", 50 },
            { "D", "E", 40 }, { "E", "C", 30 }, { "E", "F", 20 }
        }
    )
VAR Flagged = DATATABLE ( "Account", STRING, { { "D" } } )
RETURN
    NETWORK.REACH ( Payments, [Payer], [Payee], Flagged, [Account] )
NodeHopsSeed
D0D
E1D
C2D
F2D
A3D
B4D

Where D's money came from, two steps back

EVALUATE
VAR Payments =
    DATATABLE (
        "Payer", STRING, "Payee", STRING, "Amount", INTEGER,
        {
            { "A", "B", 100 }, { "B", "C", 80 }, { "C", "A", 60 }, { "C", "D", 50 },
            { "D", "E", 40 }, { "E", "C", 30 }, { "E", "F", 20 }
        }
    )
VAR Flagged = DATATABLE ( "Account", STRING, { { "D" } } )
RETURN
    NETWORK.REACH ( Payments, [Payer], [Payee], Flagged, [Account], 2, "in" )
NodeHopsSeed
D0D
C1D
B2D
E2D

Two flagged friends

Each node reached says which of the two it is nearest to.

EVALUATE
VAR Links =
    DATATABLE (
        "From", STRING, "To", STRING,
        {
            { "Ann", "Bo" }, { "Ann", "Cy" }, { "Bo", "Cy" }, { "Cy", "Di" },
            { "Di", "Ed" }, { "Ed", "Fay" }, { "Di", "Fay" }, { "Fay", "Gus" }
        }
    )
VAR Flagged = DATATABLE ( "Person", STRING, { { "Ann" }, { "Gus" } } )
RETURN
    NETWORK.REACH ( Links, [From], [To], Flagged, [Person], , "both" )
NodeHopsSeed
Ann0Ann
Gus0Gus
Bo1Ann
Cy1Ann
Fay1Gus
Di2Ann
Ed2Gus

NETWORK.PROPAGATE, NETWORK.PATH, NETWORK.SIR.NODES, FILTER.

NETWORK.REACH is OpenBI's own code: it calls no function of Open Graph, OpenBI's graph library. See the OAX network functions and Open Graph.

Last updated · OpenBI Studio 0.3.78