DATATABLE DAX Function (Table manipulation)
Returns a table with data defined inline.
Syntax
| Parameter | Attributes | Description |
|---|---|---|
| Name | Repeatable |
A column name to be defined. |
| DataType | Repeatable |
A type name to be associated with the column: BOOLEAN/LOGICAL, CURRENCY/DECIMAL, DATETIME, DOUBLE, INTEGER/INT64, STRING/TEXT. |
| Data |
The data for the table. |
Return values
A table declaring an inline set of values.
Remarks
Unlike DATATABLE, the table constructor allows any scalar expressions as input values.
The syntax used by DATATABLE is different from that used by the table constructor.
The data type name specified in DAX differs from the data types available in the user interface of products that use DAX, such as Power BI, Excel, and Visual Studio. Specifically, CURRENCY corresponds to a Fixed Decimal Number in Power BI, whereas DOUBLE corresponds to the Decimal Number in Power BI and Decimal in the DAX Data types list.
Each value in Data must be a constant. Valid values are numbers, strings, TRUE, FALSE, BLANK (), and date and time literals with the dt prefix. A minus sign directly before a number is valid. Other expressions are not valid, for example DATE, TIME, an arithmetic operation, or a string concatenation. They return an error that says the value does not have a constant expression.
DATATABLE converts each value to the data type of its column. For example, a string with a date and a time in a DATETIME column becomes a date and time value, and 2.5 in an INTEGER column becomes 3. If the conversion is not possible, DATATABLE returns an error.
A missing value is the same as BLANK (). For example, { 1, , 3 } has a blank value in the second column.
Each row must have one value for each column. Otherwise, DATATABLE returns an error.
This function is not supported in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.
Examples
-- DATATABLE is useful to build constant tables in code.
-- It requires the list of arguments and the list of rows
-- to build the table.
EVALUATE
DATATABLE (
"Name", STRING,
"Ordinal", INTEGER,
{
{ "Small", 1 },
{ "Medium", 2 },
{ "Large", 3 }
}
)
ORDER BY [Ordinal]
| Name | Ordinal |
|---|---|
| Small | 1 |
| Medium | 2 |
| Large | 3 |
Values in the definition of the table cannot be expressions; they need to be constant. The following syntax is not valid and generates an error.
EVALUATE
DATATABLE (
"Aggregation", STRING,
"Value", CURRENCY,
{
{ "Min", MIN ( Sales[Net Price] ) },
{ "Max", MAX ( Sales[Net Price] ) }
}
)
Tables with calculated expressions can be computed using the ROW function, or the table constructor {}, instead of using DATATABLE.
The table constructor requires renaming the columns.
EVALUATE
UNION (
ROW ( "Aggregation", "Min", "Value", MIN ( Sales[Net Price] ) ),
ROW ( "Aggregation", "Max", "Value", MAX ( Sales[Net Price] ) )
)
EVALUATE
SELECTCOLUMNS (
{
( "Min", MIN ( Sales[Net Price] ) ),
( "Max", MAX ( Sales[Net Price] ) )
},
"Aggregation", [Value1],
"Value", [Value2]
)
| Aggregation | Value |
|---|---|
| Min | 0.76 |
| Max | 3,199.99 |
| Aggregation | Value |
|---|---|
| Min | 0.76 |
| Max | 3,199.99 |
Related articles
Learn more about DATATABLE in the following articles:
-
Create Static Tables in DAX Using the DATATABLE Function
You can create static tables in DAX using the DATATABLE function. This article describes the syntax of this new feature and shows when and how to use it. » Read more
-
Understanding data lineage in DAX
Data lineage is such a well-implemented DAX feature that most developers use it without knowing about it. This article describes data lineage and how it can help in producing better DAX code. » Read more
-
Create static tables in Power BI, Power Pivot, and Analysis Services
A quick recap of all the methods available if you need a table with fixed static data in your data model. » Read more
-
Dynamic format strings with calculation groups
This article shows two techniques based on calculation groups: how to implement dynamic format strings in regular measures, and how to perform weight conversion on the fly. » Read more
Last update: Nov 9, 2026 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo, Kenneth Barber
Microsoft documentation: https://learn.microsoft.com/en-us/dax/datatable-function