Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

See when key Fabric features will launch and what’s already live, all in one place and always up to date. Explore the new Fabric roadmap

Reply

Creating a DAX measure to concatenate two or more course titles.

Hello,

I have a situation where I've created a very simple bar chart to display the number of courses run on a given day. So Y axis is simply 'Count of Table{course title]' and the x axis is the date. 

I want to add a tooltip for the course name. Where there is only one course, no problem, but two or more - it only displays the first/last course name. I want to create a measure that concatenates all the course names, so when I hover over a bar on my barchart, it will display all the course names. 

This is my current measure

All_Titles =
    CONCATENATEX
    (
        'TableName',
       SELECTEDVALUE
    (
        'TableName[Title]
    ),
";")
This returns the coursename for a single item or a ';' for more than one
If I use CONCATENATE it will return the coursename; for a single item or again ';' for more than one. 
 
I have thought about creating a variable and iterating through all the coursenames for a given date and appending the name to the variable, but not sure how to do this without a FOREACH function, and I don't believe this exists in DAX.
To try it, I created this measure:
 
All_Titles =
var _coursenamestring = SELECTEDVALUE('TableName'[Title])
RETURN

    CALCULATE
    (
        CONCATENATEX
        (
            'TableName',
            _coursenamestring &  ";"    
        )
    )
 No difference in result, but I didn't really expect it to. 

Can anyone help here, please? I think this should be pretty easy, but I cannot think how to do it.

Thanks alot for your help.

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

CONCATENATEX(Table,[Column],";")

View solution in original post

4 REPLIES 4
lbendlin
Super User
Super User

CONCATENATEX(Table,[Column],";")

Thank you. I actually though I had tried this before the version I added above. But it works now anyway. Tks again.

johnt75
Super User
Super User

You don't need SELECTEDVALUE, that works on the filter context but inside an iterator you have a row context. Try

All_Titles =
CONCATENATEX ( VALUES ( 'TableName'[Title] ), 'TableName'[Title], ";" )

@johnt75 Thanks for replying. This didn't allow me to add the second column, unfortunately.

 

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

Check out the May 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.