DETAILROWS
Returns the rows that lie behind a measure's value, as the measure's detail rows expression describes them.
A measure can carry a detail rows expression: a table expression, stored with the measure in the model, that says which rows and columns lie behind its number. A table can carry one for all its measures.
Group: Table manipulation. Compatible with DAX.
Syntax
DETAILROWS ( <Measure> )
| Parameter | Type | Description |
|---|---|---|
Measure | Measure | A measure of the model, in brackets. |
Returns
Table. The rows behind the measure's value in the current filter context.
Remarks
- DETAILROWS evaluates that expression with the filters in force, so the filters that shape the measure's value narrow its detail rows too.
- When neither the measure nor its table has one, you get every row of the measure's table that the filters leave, with all its columns.
- The argument must be a measure; an expression such as
SUM ( Holdings[Nominal] )is an error. A measure defined in the query has no detail rows expression, so it gives its table's rows.
Compared with DAX
Inside a row context, for example in ADDCOLUMNS, OpenBI applies the current row as a filter before it evaluates the detail rows. Power BI does not do so yet: wrap the call in CALCULATETABLE where a query must give the same rows in both.
Examples
A measure without a detail rows expression
No measure of the Example Brewery has one, so the result is the rows of the measure's own table, Holdings.
EVALUATE
DETAILROWS ( [Nominal held] )
ORDER BY Holdings[Bond]
| Holdings[Bond] | Holdings[Maturity] | Holdings[Coupon] | Holdings[Nominal] | Holdings[Price] |
|---|---|---|---|---|
| Corporate 2030 | 2030-11-25 | 0.0475 | 80000000 | 101.3 |
| Covered 2029 | 2029-06-20 | 0.04 | 120000000 | (blank) |
| Government 2028 | 2028-03-02 | 0.03 | 250000000 | 97.84 |
| Government 2033 | 2033-03-15 | 0.0225 | 300000000 | 92.15 |
| Municipal 2031 | 2031-09-01 | 0.035 | 150000000 | (blank) |
Detail rows under a filter
EVALUATE
CALCULATETABLE ( DETAILROWS ( [Nominal held] ), Holdings[Price] > 100 )
ORDER BY Holdings[Bond]
| Holdings[Bond] | Holdings[Maturity] | Holdings[Coupon] | Holdings[Nominal] | Holdings[Price] |
|---|---|---|---|---|
| Corporate 2030 | 2030-11-25 | 0.0475 | 80000000 | 101.3 |