CONCATENATEX DAX Function (Text)

Evaluates expression for each row on the table, then return the concatenation of those values in a single string result, seperated by the specified delimiter.

Syntax

CONCATENATEX ( <Table>, <Expression> [, <Delimiter>] [, <OrderBy_Expression> [, [<Order>] [, <OrderBy_Expression> [, [<Order>] [, … ] ] ] ] ] )
Parameter Attributes Description
Table
Iterator

The table containing the rows for which the expression will be evaluated.

Expression
Row Context

The expression to be evaluated for each row of the table.

Delimiter Optional

The delimiter to be concatenated with expression.

OrderBy_Expression
Row Context
Optional
Repeatable

Expression to be used for sorting the table.

Order Optional
Repeatable

The order to be applied. 0/FALSE/DESC – descending; 1/TRUE/ASC – ascending.

Return values

Scalar A single string value.

A text string with the concatenated values.

Remarks

This function iterates the rows in the table provided by the first argument and for each row it executes the expression provided in the second argument. All the expressions are concatenated using the separator provided as third argument.

The default order is ASC (ascending) when OrderBy_Expression argument is present and the corresponding Order argument is not specified.

» 5 related articles
» 1 related function

Examples

--  CONCATENATEX is an iterator that produces the concatenation
--  of expressions evaluated during the iteration.
--  You provide the expression, a separator and optional
--  sorting expressions.
EVALUATE
ADDCOLUMNS (
    VALUES ( 'Product'[Category] ),
    "Category colors", 
        CONCATENATEX ( 
            CALCULATETABLE ( VALUES ( 'Product'[Color] ) ),
            Product[Color],
            ", ",             -- Separator (optional)
            Product[Color],   -- Sorting expression (optional)
            ASC               -- Sorting direction (optional)
        )
)
Category Category colors
Audio Black, Blue, Green, Orange, Pink, Purple, Red, Silver, White, Yellow
TV and Video Black, Brown, Silver, White
Computers Black, Blue, Brown, Gold, Green, Grey, Orange, Pink, Red, Silver, White, Yellow
Cameras and camcorders Azure, Black, Blue, Gold, Green, Grey, Orange, Pink, Purple, Red, Silver, Silver Grey, White, Yellow
Cell phones Black, Gold, Grey, Pink, Red, Silver, Transparent, White
Music, Movies and Audio Books Black, Blue, Gold, Grey, Red, Silver, White, Yellow
Games and Toys Black, Blue, Gold, Green, Grey, Pink, Purple, Red, Silver, White, Yellow
Home Appliances Black, Blue, Brown, Gold, Green, Grey, Orange, Pink, Purple, Red, Silver, White, Yellow

Related articles

Learn more about CONCATENATEX in the following articles:

Related functions

Other related functions are:

Last update: Nov 14, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo, Francis Romio, Airat Gabdrakhmanov

Microsoft documentation: https://docs.microsoft.com/en-us/dax/concatenatex-function-dax

2018-2024 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of CONCATENATEX? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.