DAX Function Guide

ADDCOLUMNS Function (DAX)
Empty image or helper icon

Sam McKay

CEO & Founder

How does the ADDCOLUMNS Function (DAX) work?
This is an aggregation function used to add columns to DAX tables. It adds calculated columns to any given table or table expression. This function will return a table with all its original columns and the added ones.
ADDCOLUMNS Function (DAX) Formula Syntax

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

How do you use the ADDCOLUMNS Function (DAX)?

This function is equivalent to adding a calculated column to a table; the only real difference is that ad hoc columns are calculated only once (they’re not stored in your model). 

Related Blog Posts

Loading

Considerations when using the ADDCOLUMNS Function (DAX)?

It has 3 parameters to work with: the table to which the new columns are added, the name given to the new column and is enclosed in double-quotes, and the expression that returns a scalar expression which is evaluated for every row of the table.  

Related Video Tutorials

Loading

Formula examples using the ADDCOLUMNS Function (DAX)

= ADDCOLUMNS ( Products,”East_Sales”,
      SUMX (RELATEDTABLE (East_Sales),
      IF([Product] = East_Sales[Product], East_Sales[Sales Amount],0)
      )
)

= EVALUATE
ADDCOLUMNS (
    Species,
    “Number transactions”,
    COUNTROWS ( RELATEDTABLE ( ‘Transaction’ ) )
)

= ADDCOLUMNS (
    Products,”East_Sales”,
    SUMX (RELATEDTABLE(East_Sales),
       IF([Product] = East_Sales[Product], East_Sales[Sales Amount],0)
)

Related Courses

Loading