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

DETAILROWS ( <Measure> )
Parameter Attributes Description
Measure

A Measure reference whose DetailRows expression is to be evaluated.

Return values

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

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.

» 3 related articles

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:

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

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 DETAILROWS? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.