Cube.Transform

Updated on

Cube.Transform is a function in the Power Query M language that applies the list of cube functions, transforms, on the cube.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Cube.Transform(
   cube as table,
   transforms as list,
) as table
ArgumentAttributeDescription
cubeA table to perform cube transformation on.
transformsSpecifies a list of transformations to apply to a cube, using the SapHanaRangeOperator.Type parameter. Available operators for SAP HANA input parameters include:
SapHanaRangeOperator.GreaterThan: for ‘Greater than’
SapHanaRangeOperator.LessThan: for ‘Less than’
SapHanaRangeOperator.GreaterThanOrEquals: for ‘Greater than or equals’
SapHanaRangeOperator.LessThanOrEquals: for ‘Less than or equals’
SapHanaRangeOperator.Equals: for ‘Equals’
SapHanaRangeOperator.NotEquals: for ‘Not equals’

Description

The Cube.Transform function uses the provided list cube functions to transform the table in the cube argument.

Examples

Here’s an example of how you can use the Cube.Transform function:

let
  Source         = SapHana.Database ( "server:30015", [ Implementation = "2.0" ] ), 
  Contents       = Source{ [Name = "Contents" ]}[Data], 
  ADVENTUREWORKS = Contents { [Name = "ADVENTUREWORKS" ] }[Data], 
  AN_SALES2      = ADVENTUREWORKS{ [ Name = "AN_SALES1" ] }[Data], 
  AddedItems = 
    Cube.Transform (
      AN_SALES2, 
      {
        { Cube.ApplyParameter, "Var3", { SapHanaRangeOperator.GreaterThan, 1, null } }, 
        { Cube.AddMeasureColumn, "Average Sale Per Order", "[Measures].[AverageSalePerOrder]" }
      }
    )
in
  AddedItems

Other functions related to Cube.Transform are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/cube-transform