Returns a table with new columns specified by the DAX expressions.
The table to which new columns are added.
The name of the new column to be added.
The expression for the new column to be added.
A table with all its original columns and the added ones.
ADDCOLUMNS does not preserve the data lineage of the added columns for a following context transition, even if a column expression is a simple column reference. However, the data lineage of the column added is effective for NATURALLEFTOUTERJOIN and NATURALINNERJOIN.
» 1 related function
-- ADDCOLUMNS is an iterator that returns its first argument -- after adding the column specified. -- New columns are computed in the row context of ADDCOLUMNS, -- you need to invoke context transition to generate a filter -- context, if needed. EVALUATE FILTER ( ADDCOLUMNS ( VALUES ( 'Date'[Calendar Year] ), "@Year Number", INT ( RIGHT ( 'Date'[Calendar Year], 4 ) ), "@Amount", [Sales Amount], "@Quantity Wrong", SUM ( Sales[Quantity] ), "@Quantity Correct", CALCULATE ( SUM ( Sales[Quantity] ) ) ), [@Amount] > 0 )
|Calendar Year||@Year Number||@Amount||@Quantity Wrong||@Quantity Correct|
Learn more about ADDCOLUMNS in the following articles:
Best Practices Using SUMMARIZE and ADDCOLUMNS
Everyone using DAX is probably used to SQL query language. Because of the similarities between the Tabular data modeling and the relational data modeling, there is the expectation that you can perform the same operations as those allowed in SQL. However, in its current implementation DAX does not permit all the operations that you can […] » Read more
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
Highlighting the minimum and maximum values in a Power BI matrix
This article shows how to use DAX and conditional formatting together to highlight the minimum and maximum values in a matrix in Power BI. » Read more
From SQL to DAX: Grouping Data
The GROUP BY condition of a SQL statement is natively implemented by SUMMARIZE in DAX. This article shows how to use SUMMARIZE and an alternative syntax to group data. » Read more
Naming temporary columns in DAX
This article describes a naming convention for temporary columns in DAX expressions to avoid ambiguity with the measure reference notation. » Read more
From SQL to DAX: Projection
This article describes projection functions and techniques in DAX, showing the differences between SELECTCOLUMNS, ADDCOLUMNS, and SUMMARIZE. » Read more
Other related functions are:
Contributors: Alberto Ferrari, Marco Russo, Kenneth Barber,
Microsoft documentation: https://docs.microsoft.com/en-us/dax/addcolumns-function-dax