Table of contents
TOC
Collapse the table of content
Expand the table of content

ADDCOLUMNS Function (DAX)

Owen Duncan|Last Updated: 5/22/2018

Adds calculated columns to the given table or table expression.

Syntax

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

Parameters

table
Any DAX expression that returns a table of data.

name
The name given to the column, enclosed in double quotes.

expression
Any DAX expression that returns a scalar expression, evaluated for each row of table.

Return Value

A table with all its original columns and the added ones.

Remarks

Example

The following example returns an extended version of the Product Category table that includes total sales values from the reseller channel and the internet sales.

ADDCOLUMNS(ProductCategory,   
               , "Internet Sales", SUMX(RELATEDTABLE(InternetSales_USD), InternetSales_USD[SalesAmount_USD])  
               , "Reseller Sales", SUMX(RELATEDTABLE(ResellerSales_USD), ResellerSales_USD[SalesAmount_USD]))  

The following table shows a preview of the data as it would be received by any function expecting to receive a table:

ProductCategory[ProductCategoryName]ProductCategory[ProductCategoryAlternateKey]ProductCategory[ProductCategoryKey][Internet Sales][Reseller Sales]
Bikes1125107749.7763084675.04
Components2211205837.96
Clothing33306157.58291669943.267
Accessories44640920.1338534301.9888
© 2018 Microsoft