Short answer: CONCATENATEX ( table, expression [, delimiter [, orderBy, order ]] ) evaluates the expression for each row of a table and joins the results into one text: CONCATENATEX ( VALUES ( Customer[Country] ), Customer[Country], ", " ) returns "Austria, Germany, Switzerland". It is the way to show which values are selected in a title, to list the top products in a sentence, or to build a tooltip line. For two pieces of text, use the & operator.
A slicer shows its selection only while it is on the page. Exported, printed or in a subscription email, the reader no longer knows what was filtered. A line built with CONCATENATEX carries the selection into the title.
How do you show the selected values?
Selected Countries =
VAR N = COUNTROWS ( VALUES ( Customer[Country] ) )
VAR Total = COUNTROWS ( ALL ( Customer[Country] ) )
RETURN
SWITCH (
TRUE (),
NOT ISFILTERED ( Customer[Country] ), "All countries",
N > 3, N & " of " & Total & " countries",
CONCATENATEX ( VALUES ( Customer[Country] ), Customer[Country], ", ", Customer[Country], ASC )
)
Title = "Revenue by month, " & [Selected Countries]| Slicer selection | Title |
|---|---|
| nothing | Revenue by month, All countries |
| Austria, Germany | Revenue by month, Austria, Germany |
| 7 countries | Revenue by month, 7 of 24 countries |
Use it as a visual's title with Format, Title, fx, field value Title.
How do you list the top products?
Top 3 Products =
VAR T = TOPN ( 3, VALUES ( 'Product'[Product] ), [Revenue], DESC )
RETURN
CONCATENATEX (
T,
'Product'[Product] & " (" & FORMAT ( [Revenue], "#,0" ) & ")",
", ",
[Revenue], DESC
)Result: "Road-150 (1,200), Mountain-200 (900), Helmet (500)". TOPN picks the rows, CONCATENATEX writes them, and the orderBy keeps them in revenue order.
How do delimiters and order work?
| Argument | Example | Note |
|---|---|---|
| delimiter | ", " or " | " | between items, not after the last |
| line break | UNICHAR ( 10 ) | each item on a new line in tooltips and cards with word wrap |
| orderBy | Customer[Country] or [Revenue] | evaluated per row |
| order | ASC or DESC | Microsoft's default is DESC when omitted |
Without an orderBy, the order is not defined; always give one if the order matters.
CONCATENATEX, CONCATENATE or &?
| Use | When |
|---|---|
"a" & "b" & "c" | joining a few known texts |
CONCATENATE ( "a", "b" ) | exactly two texts; & is simpler |
CONCATENATEX ( table, ... ) | a list from a table, any number of rows |
What goes wrong?
- Very long lists. Hundreds of values make unreadable titles and slow measures; show a count above a threshold, as above.
- Duplicates. Iterating a fact table repeats values; iterate
VALUES ( column ). - Missing order. Results come in an undefined order; pass
orderByandASC. - Numbers without format.
[Revenue]inside the text shows all decimals; wrap it in FORMAT.
Where can you check this?
- Microsoft Learn: CONCATENATEX function (DAX)
- Microsoft Learn: CONCATENATE function (DAX)
- Microsoft Learn: Expression-based formatting in Power BI
Where do you start?
Add Selected Countries to the title of your main chart so exports and emails keep the filter. Text functions cover the rest of text work in DAX.