How can I create a table in Power BI using DAX?

Creating a table in Power BI using DAX (Data Analysis Expressions) involves using a combination of DAX functions and expressions to define the structure and data of the table. This can be done by first creating a measure or calculated column, then using the ADDCOLUMNS function to add additional columns and their respective calculations. The final step is to use the SUMMARIZE function to group the data and display it in a table format. This process allows for the creation of dynamic and customizable tables within Power BI.

Power BI: Create a Table Using DAX


You can use the following syntax in DAX to create a table from scratch in Power BI:

My_Table = {
    ("Mavs", 22, 5),
    ("Spurs", 30, 8),
    ("Kings", 13, 4),
    ("Warriors", 25, 12),
    ("Nuggets", 11, 4),
    ("Rockets", 40, 11)
    }

This particular syntax creates a new table named My_Table that contains 3 columns and 6 rows.

The following example shows how to use this syntax in practice.

Example: Create Table in Power BI by Using DAX

To create a table from scratch in Power BI, you must first click the Table View icon on the left side of the screen, then click the New Table icon along the top ribbon:

Next, type the following formula into the formula bar:

My_Table = {
    ("Mavs", 22, 5),
    ("Spurs", 30, 8),
    ("Kings", 13, 4),
    ("Warriors", 25, 12),
    ("Nuggets", 11, 4),
    ("Rockets", 40, 11)
    }

Once you press Enter, a table named My_Table will be created with 3 columns and 6 rows:

Power BI create table using DAX

By default, DAX uses Value1, Value2 and Value3 as the column names.

If you would like to specify the column names to use when creating the table, you can use the following syntax with the SELECTCOLUMNS function:

My_Table = SELECTCOLUMNS({
    ("Mavs", 22, 5),
    ("Spurs", 30, 8),
    ("Kings", 13, 4),
    ("Warriors", 25, 12),
    ("Nuggets", 11, 4),
    ("Rockets", 40, 11)
    },
    "Team", [Value1],
    "Points", [Value2],
    "Assists", [Value3])

This will create the following table with column names “Team”, “Points” and “Assists”:

Power BI create table with specific column names using DAX

Note: You can find the complete documentation for the SELECTCOLUMNS function in DAX .

Additional Resources

The following tutorials explain how to perform other common tasks in Power BI:

x