SELECTCOLUMNS

Updated on

SELECTCOLUMNS is a DAX function that returns a table with selected columns from an existing table and new columns defined by DAX expressions.

Syntax

SELECTCOLUMNS(
   Table,
   [ Name, ... ],
   [ Expression, ... ]
)
Argument Properties Description
Table The table from which columns are selected.
Name Optional, 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 the same number of rows as the table specified as the first argument. The returned table has one column for each pair of Name, 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.

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

Example

For the following table named Customer:

Country State Count Total
IND JK 20 800
IND MH 25 1000
IND WB 10 900
USA CA 5 500
USA WA 10 900
SELECTCOLUMNS(Customer, "Country, State", [Country]&", "&[State])

Returns,

Country, State
IND, JK
IND, MH
IND, WB
USA, CA
USA, WA

Other functions related to SELECTCOLUMNS are:

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

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