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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.