TABLEOF DAX Function (Information)

Returns the table that the specified column, measure, or calendar belongs to.

Syntax

TABLEOF ( <Reference> )
Parameter Attributes Description
Reference

A column, measure, or calendar reference whose base table is returned.

Return values

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

The table that contains the column, measure, or calendar passed as a parameter.

Remarks

In the description of the Reference parameter, “base table” means the table where the column, measure, or calendar is defined. It does not mean the base table before table expansion. For a column, TABLEOF returns the table that contains the column. For a measure, it returns the home table of the measure. For a calendar, it returns the table where the calendar is defined.

When the argument is a column reference, TABLEOF uses the column only to identify its table. TABLEOF does not use the value of the column in the current row. This is the same behavior as other functions that accept a column reference, such as SUM. The result is the table filtered by the current filter context, like a table reference. A row context does not filter the result, unless a context transition occurs, for example inside CALCULATE.

» 2 related articles
» 1 related function

Examples

TABLEOF returns the table of a column, the home table of a measure, and the table where a calendar is defined. NAMEOF shows the name of the table that TABLEOF returns. COUNTROWS counts the rows of that table.

EVALUATE
SELECTCOLUMNS (
    {
        ( "Product[Color]", NAMEOF ( TABLEOF ( Product[Color] ) ), COUNTROWS ( TABLEOF ( Product[Color] ) ) ),
        ( "[Sales Amount]", NAMEOF ( TABLEOF ( [Sales Amount] ) ), COUNTROWS ( TABLEOF ( [Sales Amount] ) ) ),
        ( "Fiscal", NAMEOF ( TABLEOF ( Fiscal ) ), COUNTROWS ( TABLEOF ( Fiscal ) ) )
    },
    "Reference", [Value1],
    "Table", [Value2],
    "Rows", [Value3]
)
Reference Table Rows
Product[Color] 'Product' 2,517
[Sales Amount] 'Sales' 100,231
Fiscal 'Date' 2,556

The function receives only a column. TABLEOF gets the table of the column. Thus, the function can count the rows of the table and the rows with a blank value, without a table parameter.

DEFINE
    FUNCTION Local.ColumnProfile = ( col : COLUMNREF ) =>
        ROW (
            "Column", NAMEOF ( col ),
            "Table", NAMEOF ( TABLEOF ( col ) ),
            "Rows", COUNTROWS ( TABLEOF ( col ) ),
            "Distinct values", DISTINCTCOUNT ( col ),
            "Blank rows", COUNTROWS ( FILTER ( TABLEOF ( col ), ISBLANK ( col ) ) ) + 0
        )
EVALUATE
UNION (
    Local.ColumnProfile ( Product[Color] ),
    Local.ColumnProfile ( Customer[Company Name] ),
    Local.ColumnProfile ( Store[Store Name] )
)
Column Table Rows Distinct values Blank rows
'Product'[Color] 'Product' 2,517 16 0
'Customer'[Company Name] 'Customer' 18,869 386 18,484
'Store'[Store Name] 'Store' 304 304 0

TABLEOF ( cal ) returns the table where the calendar is defined. COUNTROWS counts the days visible in the filter context. Thus, the function divides the measure by the number of days in the current period. The function also works with DATEADD, because DATEADD changes the visible days.

DEFINE
    FUNCTION Local.DailyAverage = ( amount : MEASUREREF, cal : CALENDARREF ) =>
        DIVIDE ( amount, COUNTROWS ( TABLEOF ( cal ) ) )
EVALUATE
SUMMARIZECOLUMNS (
    'Date'[Fiscal Year],
    "Days", COUNTROWS ( TABLEOF ( Fiscal ) ),
    "Daily Sales", Local.DailyAverage ( [Sales Amount], Fiscal ),
    "Daily Sales PY", CALCULATE ( Local.DailyAverage ( [Sales Amount], Fiscal ), DATEADD ( Fiscal, -1, YEAR ) )
)
ORDER BY 'Date'[Fiscal Year]
Fiscal Year Days Daily Sales Daily Sales PY
FY 2005 181 (Blank) (Blank)
FY 2006 365 (Blank) (Blank)
FY 2007 365 15,598.01 (Blank)
FY 2008 366 27,789.88 15,598.01
FY 2009 365 26,551.84 27,789.88
FY 2010 365 13,796.03 26,551.84
FY 2011 365 (Blank) 13,796.03
FY 2012 184 (Blank) (Blank)

Related articles

Learn more about TABLEOF in the following articles:

Related functions

Other related functions are:

Last update: Oct 26, 2026   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://learn.microsoft.com/dax/tableof-function-dax

2018-2026 © 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.

Passed by Expression

This parameter is passed by expression and can be evaluated multiple times in different evaluation contexts.

Iterator

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.

Deprecated

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

Volatile

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

Deprecated

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.

Contribute

Want to improve the content of TABLEOF? 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.