OpenBI Docs Buy

NETWORK.EDGES OpenBI

Lists the links a table's rows make, one row a link, with the weights of repeated rows added together.

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

Syntax

NETWORK.EDGES ( <links>, <from>, <to> [, <weight>] [, <directed>] )
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.
weightExpression
optional, evaluated for each row
How heavy each row's link is, such as an amount or a count; never negative. Left out, or given as the constant BLANK (), every row weighs 1.
directedBoolean
optional
TRUE when each link runs one way, from its first end to its second. FALSE or left out, a link works both ways.

Returns

Table. A row a link, with the columns From, To and Weight.

Remarks

  • Several rows between the same two nodes make one link, and their weights add up. Without a weight each row adds 1, so a pair that appears three times weighs 3.
  • In a network that is not directed, a row from A to B and a row from B to A are the same link. Its ends are listed in the nodes' order, the smaller value first; the links are listed in that order too.
  • The rows come out in the order of the nodes' values: numbers from the smallest, then text by character code with capitals read as small letters (A and a together, Ä after z), then dates, then FALSE and TRUE. Rows that come in another order give the same result, communities and ties included; up to 0.3.76 the order the rows came in could change them.
  • Rows where an end is blank, or where both ends are the same node, add no link; the end that is there still counts as a node.
  • With a weight, a row whose weight is blank or 0 adds no link either.
  • It is the table to draw a network's lines from, beside NETWORK.LAYOUT for the nodes; NETWORK.LINKS measures the same links.

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

Rows that make one link

Three rows between A and B, in both directions, are one link of weight 6. C has no other end, D links to itself, and the row from E to F weighs 0: none of them is a link.

EVALUATE
VAR Rows =
    DATATABLE (
        "From", STRING, "To", STRING, "Weight", INTEGER,
        {
            { "A", "B", 2 }, { "B", "A", 3 }, { "A", "B", 1 },
            { "C", BLANK (), 5 }, { "D", "D", 1 }, { "E", "F", 0 }
        }
    )
RETURN
    NETWORK.EDGES ( Rows, [From], [To], [Weight] )
FromToWeight
AB6

The same rows, one way

Directed, A to B and B to A are two links. Without a weight, the row from E to F counts 1.

EVALUATE
VAR Rows =
    DATATABLE (
        "From", STRING, "To", STRING, "Weight", INTEGER,
        {
            { "A", "B", 2 }, { "B", "A", 3 }, { "A", "B", 1 },
            { "C", BLANK (), 5 }, { "D", "D", 1 }, { "E", "F", 0 }
        }
    )
RETURN
    NETWORK.EDGES ( Rows, [From], [To], , TRUE )
FromToWeight
AB2
BA1
EF1

NETWORK.NODES, NETWORK.LAYOUT, NETWORK.GRAPH, SUMMARIZE.

NETWORK.EDGES 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