SELECTCOLUMNS DAX Function

The SELECTCOLUMNS function returns a table with selected columns from the table and new columns specified by the DAX expressions.

DAX Syntax SELECTCOLUMNS(Table, Name, Expression, [Name], …)

The function has the following parameters:
Table: Any DAX expression that returns a table. The table from which columns are selected. It can be virtual or physical 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. The expression for the new column to be added.

The function returns 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.

Example: For the following table named Customer:

SELECTCOLUMNS dax function

DAX

SELECTCOLUMNS(Customer, "Country, State", [Country]&", "&[State])

Returns,

SELECTCOLUMNS dax function

DAX

SELECTCOLUMNS (FILTER(Customer, [COUNTRY]=“IND”, "Country, State", [Country]&", "&[State])

Example: The following is the image of Sheet1 table.

SELECTCOLUMNS dax function

DAX

Table 2 = SELECTCOLUMNS('Sheet1',"Concatenated string", 'Sheet1'[Name] & "--" & 'Sheet1'[Country])
SELECTCOLUMNS dax function