How can I use DAX to create a table in Power BI?

DAX (Data Analysis Expressions) is a formula language used in Power BI to manipulate data and create calculated measures and columns. To create a table in Power BI using DAX, you can use the DAX function “DATATABLE” which allows you to define the structure and values of a table within the formula. This function takes in parameters such as column names, data types, and values, and returns a table that can be used in your Power BI report. By using DAX, you can customize and create tables that meet your specific data analysis needs, making your Power BI reports more powerful and insightful.


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