Cube.Measures

Table

Returns a table containing the set of available measures within a cube.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Cube.Measures(cube as any) as table

Parameters

NameTypeRequiredDescription
cubeanyYesThe cube to retrieve measures from.

Return Value

tableA table listing the available measures in the cube, where each measure is represented as a function.

Remarks

Cube.Measures returns a table containing the set of available measures within the specified cube. Each measure is represented as a function that can be evaluated in a specific dimensional context. Measures are the quantitative values in an OLAP cube -- they represent the data that is aggregated and analyzed (e.g., Sales Amount, Order Count, Profit Margin).

Measures from this table can be applied to the cube using Cube.AddMeasureColumn. The measure selector values from this table are passed as the measureSelector argument. Individual measure properties (such as format string or aggregation type) can be retrieved using Cube.MeasureProperty.

In Analysis Services multidimensional models, measures are organized into measure groups. In tabular models, measures are defined within tables using DAX expressions.

Examples

Example 1: List all measures in a cube

let
    Source = AnalysisServices.Database("localhost", "AdventureWorks"),
    Cube = Source{[Name = "Adventure Works"]}[Data],
    Measures = Cube.Measures(Cube)
in
    Measures

Example 2: Select a measure and add it to the cube

let
    Source = AnalysisServices.Database("localhost", "AdventureWorks"),
    Cube = Source{[Name = "Adventure Works"]}[Data],
    Measures = Cube.Measures(Cube),
    SalesMeasure = Measures{[Name = "Internet Sales Amount"]}[Value],
    WithSales = Cube.AddMeasureColumn(Cube, "Sales", SalesMeasure)
in
    WithSales

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks