cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
yogeshk77
Helper I
Helper I

Multiple rows into a single column with Many to Many relationship

I have following tables with two level parent child hirarchy

yogeshk77_0-1664797115475.png

 

yogeshk77_1-1664797134498.png

 

yogeshk77_2-1664797157799.png

 

And the output I need is a , comma separated Repo Names column in Story Table as seen below ->

 

yogeshk77_3-1664797206680.png

Can someone please help me with a DAX query for the same?

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Try

Repos =
VAR CurrentStory = Story[Story ID]
VAR PRs =
    CALCULATETABLE (
        VALUES ( 'Story PR'[PR ID] ),
        TREATAS ( { CurrentStory }, 'Story PR'[Story ID] )
    )
RETURN
    CONCATENATEX (
        CALCULATETABLE (
            VALUES ( 'PR Repo'[Repo name] ),
            TREATAS ( PRs, 'PR Repo'[PR ID] )
        ),
        'PR Repo'[Repo name],
        ", "
    )

View solution in original post

2 REPLIES 2
johnt75
Super User
Super User

Try

Repos =
VAR CurrentStory = Story[Story ID]
VAR PRs =
    CALCULATETABLE (
        VALUES ( 'Story PR'[PR ID] ),
        TREATAS ( { CurrentStory }, 'Story PR'[Story ID] )
    )
RETURN
    CONCATENATEX (
        CALCULATETABLE (
            VALUES ( 'PR Repo'[Repo name] ),
            TREATAS ( PRs, 'PR Repo'[PR ID] )
        ),
        'PR Repo'[Repo name],
        ", "
    )

@johnt75 , you are awesome ! Thanks much

Helpful resources

Announcements
T-Shirt Design Challenge 2023

Power BI T-Shirt Design Challenge 2023

Submit your creative T-shirt design ideas starting March 7 through March 21, 2023.

March 2023 Update3

Power BI March 2023 Update

Find out more about the March 2023 update.

March Events 2023A

March 2023 Events

Find out more about the online and in person events happening in March!