DATATABLE DAX Function (Table manipulation)

Returns a table with data defined inline.


DATATABLE ( <name>, <type> [, <name>, <type> [, … ] ], <data> )
Parameter Attributes Description
name Repeatable

A column name to be defined.

type Repeatable

A type name to be associated with the column.


The data for the table.

Return values

Table An entire table or a table with one or more columns.

A table declaring an inline set of values.


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.

» 3 related articles


--  DATATABLE is useful to build constant tables in code.
--  It requires the list of arguments and the list of rows
--  to build the table.
    "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.

    "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.

    UNION (
        ROW ( "Aggregation", "Min", "Value", MIN ( Sales[Net Price] ) ),
        ROW ( "Aggregation", "Max", "Value", MAX ( Sales[Net Price] ) )

            ( "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:

Last update: Jan 31, 2023   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo, Kenneth Barber

Microsoft documentation:

2018-2023 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.


Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.


This function is deprecated. Jump to the Alternatives section to see the function to use.


A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.


This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.


Want to improve the content of DATATABLE? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.