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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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

Top Kudoed Authors