ADDCOLUMNS

Updated on

ADDCOLUMNS is a DAX function that returns a table with new columns specified by DAX expressions.

Syntax

ADDCOLUMNS(
   Table,
   [ Name, ... ],
   [ Expression, ... ]
)
Argument Properties Description
Table The table to which new columns are added.
Name Repeatable The name of the new column to be added.
Expression Repeatable The expression for the new column to be added.

Return Values

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

Remarks

This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.

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]
Bikes 1 1 25107749.77 63084675.04
Components 2 2 11205837.96
Clothing 3 3 306157.5829 1669943.267
Accessories 4 4 640920.1338 534301.9888

Other functions related to ADDCOLUMNS are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/dax/addcolumns-function-dax

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy