Power BI: How to 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 here.

Additional Resources

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

How to Count Number of Occurrences in Power BI
How to Write an IF Statement in Power BI
How to Write an IF Statement with Multiple Conditions in Power BI

Leave a Reply

Your email address will not be published. Required fields are marked *