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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
huguestremblay
Helper II
Helper II

Concatenate values from related table

Hello,

I need to concatenate values from a related table but cannot figure out how to get it done.  I have used a measure with CONCATENATEX when I need to concatenate value from a single table, but it doesn't work here.

 

My scenario is as follows:

huguestremblay_1-1634312468567.png

 

I have a Main table (that contains several more fields than what is shown here) and a Clients table that "harmonises" client names.  The two tables are linked by the Client field. Some records apply to multiple clients and I need a summary table visual that will concatenate the various client names on a single row for each ID.

 

Any help woul be appreciated 🙂

 

 

2 ACCEPTED SOLUTIONS
smpa01
Super User
Super User

@huguestremblay  

You can write a measure like this

 

 

Measure =
CALCULATE (
    CONCATENATEX (
        RELATEDTABLE ( client ),
        client[Final],
        ",",
        MAX ( main[Client] ), ASC
    ),
    CROSSFILTER ( main[Client], client[Client], BOTH )
)

 

 

smpa01_0-1634313734042.png

 

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

@huguestremblay  okay try this

 

Measure = 
CALCULATE (
    CONCATENATEX (
        SUMMARIZE(RELATEDTABLE ( client ),client[Client],client[Final]),
        client[Final],
        ",",
        MAX ( main[Client] ), ASC
    ),
    CROSSFILTER ( main[Client], client[Client], BOTH )
)

 

new pbix  is attached

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

5 REPLIES 5
huguestremblay
Helper II
Helper II

Hello @smpa01 , for some of my records, I am getting duplicate values in the result (e.g. Client A, Client A, Client B).  Is there a way to eliminate the duplkicates to only get each unique value listed once?

Thanks!

@huguestremblay  okay try this

 

Measure = 
CALCULATE (
    CONCATENATEX (
        SUMMARIZE(RELATEDTABLE ( client ),client[Client],client[Final]),
        client[Final],
        ",",
        MAX ( main[Client] ), ASC
    ),
    CROSSFILTER ( main[Client], client[Client], BOTH )
)

 

new pbix  is attached

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
smpa01
Super User
Super User

@huguestremblay  

You can write a measure like this

 

 

Measure =
CALCULATE (
    CONCATENATEX (
        RELATEDTABLE ( client ),
        client[Final],
        ",",
        MAX ( main[Client] ), ASC
    ),
    CROSSFILTER ( main[Client], client[Client], BOTH )
)

 

 

smpa01_0-1634313734042.png

 

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Thanks again, this works perfectly. 

Awesome, thanks a lot!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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