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

SELECTCOLUMNS Function (DAX)

Owen Duncan|Last Updated: 10/5/2018
|
1 Contributor

Adds calculated columns to the given table or table expression.

Syntax

SELECTCOLUMNS(<table>, <name>, <scalar_expression> [, <name>, <scalar_expression>]…) 

Parameters

table
Any DAX expression that returns a table.

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

expression
Any expression that returns a scalar value like a column reference, integer, or string value.

Return Value

A table with the same number of rows as the table specified as the first argument. The returned table has one column for each pair of <name>, <scalar_expression> arguments, and each expression is evaluated in the context of a row from the specified <table> argument.

Remarks

SELECTCOLUMNS has the same signature as ADDCOLUMNS, and has the same behavior except that instead of starting with the <table> specified, SELECTCOLUMNS starts with an empty table before adding columns.

Example

For the following table named Info:

CountryStateCountTotal
INDJK20800
INDMH251000
INDWB10900
USACA5500
USAWA10900
SELECTCOLUMNS(Info, “StateCountry”, [State]&”, ”&[Country])

Returns:

StateCountry
IND, JK
IND, MH
IND, WB
USA, CA
USA, WA
© 2018 Microsoft