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.

Remarks

IMPORTANT : DETAILROWS should have performed a context transition, but this design has not been implemented. As a workaround, if called in a row context, it should be wrapped in a CALCULATETABLE statement. Do not use in a row context if the intended behavior should not execute the context transition – assign the result of DETAILROWS in a variable before the iterator in that case.

» 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]
)

DETAILSROWS 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

Related articles

Learn more about DETAILROWS in the following articles:

Last update: Nov 14, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://docs.microsoft.com/en-us/dax/detailrows-function-dax

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

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.


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