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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

all combination of a column

Hello all,

Recently I am trying to solve this problem but could not way to find it, I decided to post it here as my first post. I hope there is a way to do this in PowerBi.

I have a table with two columns that show the Group name and email address.

 

1.png

 

I want to reshape this data to use it in a chord visual. For that visual, I need a new table with three-column "to, from, the value".

I would like to see something like this.

 

2.png 


To and From column will be all combinations of Group names and the Value column will be the number of common people across Groups.

Thank you and best regards


1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

One way to do that is as follows

 

Make a crossjoin table to get all the combinations of Group Name with

 

CJ =
CROSSJOIN (
    SELECTCOLUMNS (
        'Group',
        "To", 'Group'[Group Name]
    ),
    SELECTCOLUMNS (
        'Group',
        "From", 'Group'[Group Name]
    )
)

 

Then make a table visual with the From and To columns from that table, and use this measure, replace Group with your actual initial table name.

 

Count From To =
VAR vFrom =
    SELECTEDVALUE ( CJ[From] )
VAR vTo =
    SELECTEDVALUE ( CJ[To] )
RETURN
    COUNTROWS (
        FILTER (
            VALUES ( 'Group'[Email Address] ),
            CALCULATE (
                DISTINCTCOUNT ( 'Group'[Group Name] ),
                'Group'[Group Name] = vFrom
                    || 'Group'[Group Name] = vTo
            ) = 2
        )
    )

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
Anonymous
Not applicable

To get all possibilities you can import the "to" column as a table and import the "from" column as a second table. Then merge to get all possible combinations. 

mahoneypat
Microsoft Employee
Microsoft Employee

One way to do that is as follows

 

Make a crossjoin table to get all the combinations of Group Name with

 

CJ =
CROSSJOIN (
    SELECTCOLUMNS (
        'Group',
        "To", 'Group'[Group Name]
    ),
    SELECTCOLUMNS (
        'Group',
        "From", 'Group'[Group Name]
    )
)

 

Then make a table visual with the From and To columns from that table, and use this measure, replace Group with your actual initial table name.

 

Count From To =
VAR vFrom =
    SELECTEDVALUE ( CJ[From] )
VAR vTo =
    SELECTEDVALUE ( CJ[To] )
RETURN
    COUNTROWS (
        FILTER (
            VALUES ( 'Group'[Email Address] ),
            CALCULATE (
                DISTINCTCOUNT ( 'Group'[Group Name] ),
                'Group'[Group Name] = vFrom
                    || 'Group'[Group Name] = vTo
            ) = 2
        )
    )

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Thank you, Pat!  This is exactly what I wanted to have!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors