TABLEOF DAX Function (Information)
Returns the table that the specified column, measure, or calendar belongs to.
Syntax
| Parameter | Attributes | Description |
|---|---|---|
| Reference |
A column, measure, or calendar reference whose base table is returned. |
Return values
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.
» 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:
-
DAX user-defined functions (UDF) vs. calculation groups
This article describes the different roles of user-defined functions and calculation groups, explaining when to use either, and how they complement each other in the design of a semantic model. » Read more
-
Understanding parameter types in DAX user-defined functions (UDF)
This article describes the parameter types available in DAX user-defined functions, focusing on the specialized reference types MEASUREREF, COLUMNREF, TABLEREF, and CALENDARREF. » Read more
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