ADDCOLUMNS is a DAX aggregation function used to add calculated columns to the given table or table expression.
It belongs to the Table Manipulation DAX Functions category and returns a table with all its original columns along with the added ones.
ADDCOLUMNS(<table>, <name>, <expression>[ <name>, <expression>]…)
|1||table||Table or a DAX expression that returns a table.|
|2||name||The name given to the new column.|
|3||expression||DAX expression that returns a scalar expression, evaluated for each row of table.|
Let’s proceed with an example. You can access the sample dataset by downloading it from the link provided below.
Step 1: Go to Modeling tab and click on New Table
Step 2: After that, one DAX formula screen will appear, where we will write a DAX formula for the ADDCOLUMNS function.
So now, we will multiply ‘Unit Price‘ by 1000 and store into new column ‘TotalPrice‘.
Orders_New = ADDCOLUMNS(Orders, "TotalPrice", Orders[Unit Price]*1000)
Step 3: After clicking to commit, it will create a new table named ‘Orders_New,’ and under that table, you will see a new column called ‘TotalPrice’ with the result as shown below.
Refer more DAX functions: DAX Tutorials
Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome.