- Marek Vavrovic
Updated: Oct 5, 2021
Returns a table with a single row containing values that result from the expressions given to each column.
ROW(<name>, <expression>[[,<name>, <expression>]…])
name The name of the column, enclosed in double quotes.
expression Any DAX expression that returns a single scalar value to populate name.
This formula returns total number of points and number of countries.
ADDCOLUMNS(<table>, <name>, <expression>)
"Points total", SUM ( tblTable[Points] ),
"Number of countries", DISTINCTCOUNT ( tblTable[Country] )
"Ratio", DIVIDE ( [Number of countries], [points total] )
UNION(<table_expression1>, <table_expression2> [,<table_expression>]…)
This function returns the selected columns from some source table.
SELECTCOLUMNS(<table>, <name>, <scalar_expression>)
Table manipulation functions are not supported for use in DirectQuery mode.
This function doesn't keep the source table columns
SelectColumns Vs. AddColumns
One big difference of SelectColumns and AddColumns is that AddColumns keep all the existing columns in the table and adds more columns to that, But the SelectColumns starts with no columns from the table, and builds a custom subset of columns or with additional calculated columns on it.