EXTERNALMEASURE

Applies to: Calculated column Calculated table Measure Visual calculation

Invokes a measure defined in a remote model and returns its result.

Syntax

EXTERNALMEASURE(<MeasureName>[, <Type>[, <Datasource>]])

Parameters

Term Definition
MeasureName Name of the measure as defined in the remote model.
Type (Optional) An enumeration that includes: BOOLEAN/LOGICAL, CURRENCY/DECIMAL, DATETIME, DOUBLE, INTEGER/INT64, STRING/TEXT, VARIANT. If omitted, defaults to VARIANT.
Datasource (Optional) The name of the connection to the remote model. If omitted, the connection is inferred as described in Remarks.

Return value

Result of the remote measure with the data type specified in Type, or VARIANT if Type is omitted.

Remarks

  • You can only use this function in composite models that have a remote model connection.

  • If Datasource is omitted, the function uses the remote connection associated with the current table context. If there is no current table context, the function uses the connection only when a single remote data source is available. If a connection cannot be resolved unambiguously, an error is returned.

  • To omit Type while specifying Datasource, leave the second argument empty and retain its comma.

Example

If the remote model connection is called DirectQuery to AS - Adventure Works DW 2020 and the remote model defines a measure called Total Sales you can invoke that measure and return its result as currency using:

Total Sales Remote =
EXTERNALMEASURE (
    "Total Sales",
    CURRENCY,
    "DirectQuery to AS - Adventure Works DW 2020"
)