ROW DAX Function (Table manipulation)
Returns a single row table with new columns specified by the DAX expressions.
Syntax
Parameter | Attributes | Description |
---|---|---|
Name | Repeatable |
Name of the new column. |
Expression | Repeatable |
The expression for the column. |
Return values
A single row table.
Remarks
ROW does not preserve the data lineage of the returned columns returned, even though a column expression is a simple column reference.
Examples
-- ROW generates a table with one row only. -- You provide the name of the columns and their values. EVALUATE ROW ( "Sales in 2009", CALCULATE ( [Sales Amount], 'Date'[Calendar Year] = "CY 2009" ), "Sales in 2008", CALCULATE ( [Sales Amount], 'Date'[Calendar Year] = "CY 2008" ) )
Sales in 2009 | Sales in 2008 |
---|---|
9,353,814.87 | 9,927,582.99 |
-- Expressions evaluated in ROW respect the filter context. EVALUATE CALCULATETABLE ( ROW ( "Sales in 2009", CALCULATE ( [Sales Amount], 'Date'[Calendar Year] = "CY 2009" ), "Sales in 2008", CALCULATE ( [Sales Amount], 'Date'[Calendar Year] = "CY 2008" ) ), 'Product'[Brand] = "Contoso" )
Sales in 2009 | Sales in 2008 |
---|---|
2,253,412.80 | 2,369,167.68 |
-- ROW controls the name of the columns, whereas the table constructor -- automatically assigns column names. You must use SELECTCOLUMNS to control -- the column names of a table constructor as you do in ROW. DEFINE VAR Sales_2009_2008 = { ( CALCULATE ( [Sales Amount], 'Date'[Calendar Year] = "CY 2009" ), CALCULATE ( [Sales Amount], 'Date'[Calendar Year] = "CY 2008" ) ) } VAR RenamedColumns = SELECTCOLUMNS ( Sales_2009_2008, "Sales in 2009", [Value1], "Sales in 2008", [Value2] ) EVALUATE Sales_2009_2008 EVALUATE RenamedColumns
Value1 | Value2 |
---|---|
9,353,814.87 | 9,927,582.99 |
Sales in 2009 | Sales in 2008 |
---|---|
9,353,814.87 | 9,927,582.99 |
Related articles
Learn more about ROW in the following articles:
-
Using GENERATE and ROW instead of ADDCOLUMNS in DAX
This article explains how to improve DAX queries using GENERATE and ROW instead of ADDCOLUMNS when you create table expressions. » Read more
-
Computing accurate percentages with row-level security in Power BI
This article shows how to compute ratios when row-level security hides some of the data. If the percentage also includes the hidden rows in the comparison, you should customize the data model and the measures involved to get the right result. » Read more
Last update: Nov 14, 2024 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo
Microsoft documentation: https://docs.microsoft.com/en-us/dax/row-function-dax