Home » DAX » DAX – ADDCOLUMNS function

DAX – ADDCOLUMNS function

ADDCOLUMNS DAX Power BI

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.

Syntax:

ADDCOLUMNS(<table>, <name>, <expression>[ <name>, <expression>]…)




Description:

Sno. Parameter Description
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.

SuperStoreUS-2015.xlxs

DAX function - AddColumns Sample Dataset

DAX function – AddColumns Sample Dataset

Step 1: Go to Modeling tab and click on New Table

Create New Table - Power Bi

Create New Table – Power Bi

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.

Addcolumns DAX funtion

ADDCOLUMNS DAX funtion

Refer more DAX functions: DAX Tutorials

Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome.

Leave a Reply