DETAILROWS DAX Function (Table manipulation)
Returns the table data corresponding to the DetailRows expression defined on the specified Measure. If a DetailRows expression is not defined then the entire table to which the Measure belongs is returned.
Syntax
| Parameter | Attributes | Description |
|---|---|---|
| Measure |
A Measure reference whose DetailRows expression is to be evaluated. |
Return values
The rows returned by the Detail Rows Expression of the measure, evaluated in the filter context. If the measure has no Detail Rows Expression, the rows of the table that contains the measure.
Remarks
IMPORTANT: DETAILROWS does not apply a context transition. This is a known limitation: the original design includes a context transition, but it was not implemented. In a row context, DETAILROWS ignores the current row and uses only the filter context. To get the detail rows of the current row, put DETAILROWS inside CALCULATETABLE. If a future fix of this behavior must not change your code, store the result of DETAILROWS in a variable before the iterator.
Examples
Consider the following Detail Rows Expression in the Sales Amount measure:
SELECTCOLUMNS (
Sales,
"Order Number", Sales[Order Number],
"Order Line Number", Sales[Order Line Number],
"Customer", RELATED ( Customer[Name] ),
"Product", RELATED ( 'Product'[Product Name] ),
"Quantity", Sales[Quantity],
"Line Amount", Sales[Quantity] * Sales[Net Price]
)
DETAILROWS invokes the Detail Rows Expression for the corresponding measure in the same filter context.
-- Show DETAILROWS for transactions made in one day
EVALUATE
CALCULATETABLE (
DETAILROWS ( [Sales Amount] ),
'Date'[Date] = DATE ( 2007, 9, 19 ),
Customer[Customer Type] = "Person"
)
| Order Number | Order Line Number | Customer | Product | Quantity | Line Amount |
|---|---|---|---|---|---|
| 20070919123935 | 1 | Barnes, Alexis | Contoso 512MB MP3 Player E51 Blue | 1 | 11.69 |
| 20070919123937 | 1 | Ruiz, Eddie | Contoso 512MB MP3 Player E51 Blue | 1 | 11.69 |
| 20070919123941 | 1 | Anderson, Eduardo | Contoso 512MB MP3 Player E51 Blue | 1 | 11.69 |
| 20070919427828 | 1 | Gao, Ernest | Fabrikam Social Videographer 2/3” 17mm E100 Grey | 1 | 144.00 |
| 20070919712464 | 1 | Cook, Jared | MGS Rise of Nations2009 E152 | 1 | 38.70 |
| 20070919712465 | 1 | Patel, Cassandra | MGS Rise of Nations2009 E152 | 1 | 38.70 |
| 20070919712466 | 1 | He, Willie | MGS Rise of Nations2009 E152 | 1 | 38.70 |
| 20070919712467 | 1 | Jones, Jennifer | MGS Rise of Nations2009 E152 | 1 | 38.70 |
| 20070919525616 | 1 | Rubio, Jésus | The Phone Company Touch Screen Phones – CRT M11 Grey | 1 | 170.10 |
| 20070919525617 | 1 | Shan, Leonard | The Phone Company Touch Screen Phones – CRT M11 Grey | 1 | 170.10 |
| 20070919525618 | 1 | Hernandez, Albert | The Phone Company Touch Screen Phones – CRT M11 Grey | 1 | 170.10 |
| 20070919123936 | 1 | Vazquez, Monique | Contoso 512MB MP3 Player E51 Blue | 4 | 46.76 |
| 20070919525615 | 1 | Hall, Destiny | The Phone Company Touch Screen Phones – CRT M11 Grey | 4 | 680.40 |
-- DETAILROWS does not apply a context transition.
-- In a row context, use CALCULATETABLE to get the rows of the current row.
EVALUATE
ADDCOLUMNS (
VALUES ( Customer[Customer Type] ),
"Rows without CALCULATETABLE", COUNTROWS ( DETAILROWS ( [Sales Amount] ) ),
"Rows with CALCULATETABLE", COUNTROWS ( CALCULATETABLE ( DETAILROWS ( [Sales Amount] ) ) )
)
| Customer Type | Rows without CALCULATETABLE | Rows with CALCULATETABLE |
|---|---|---|
| Person | 100231 | 22172 |
| Company | 100231 | 78059 |
Related articles
Learn more about DETAILROWS in the following articles:
-
Controlling drillthrough using Detail Rows Expressions in DAX
The Detail Rows Expression in a Tabular model provides the user with control over the drillthrough results obtained by showing details of a measure. This article describes typical DAX expressions you can use in this property. » Read more
-
Creating table functions in DAX using DETAILROWS
This article describes how to use the detail rows expression of a measure to obtain the equivalent of creating table functions in DAX. This allows the reusing of a table expression in multiple CALCULATE filters. » Read more
-
Controlling drillthrough in Excel PivotTables connected to Power BI or Analysis Services
This article describes how to customize the drillthrough experience in Excel PivotTables connected to Power BI datasets or Analysis Services databases. » Read more
Last update: Nov 11, 2026 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo
Microsoft documentation: https://learn.microsoft.com/en-us/dax/detailrows-function-dax