Table constructor in DAX in Power BI

The table constructor { } can be used to build tables containing one or more columns or rows, based on fixed values or DAX expressions which return scalar values.

When there is only one column in the table, the name of the column is Value. When there are N columns where N > 1, the names of the columns from left to right are Value1, Value2, …, ValueN.

Note: The column headers can’t be defines using constructor syntax.

Syntax 1: Single Column with multiple rows DAX Syntax {scalarExpr1, scalarExpr2, …}

Example: Let’s we have following data in the table named ‘Students’.

Table constructor in DAX in Power BI

Let’s create a new table clicking on “New table” from the Table tools.

DAX

Table 6 = {SUM('Students'[Marks]), MAX('Students'[EmployeeID])}

The above dax expression returns a single column, as shown in the image below:

Table constructor in DAX in Power BI

Syntax 2: Single row with multiple columns DAX Syntax { ( scalarExpr1, scalarExpr2, … )}

Example: Let’s create a table with two columns.

DAX

Table 6 = {(SUM('Students'[Marks]), MAX('Students'[EmployeeID]))}

The above dax expression returns two columns, as shown in the image below:

Table constructor in DAX in Power BI