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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Sasha
Helper III
Helper III

Comparing field to itself

I have the following data about ownership of barbers in three barber shops

enter image description here

I'm interested presenting a matrix on PBI where the rows are barbers that are owners in at least one barber shop and the columns are all barbers. Each cell in the matrix to represent relationship between the barbers when they're owners and the rest of the barbers. If two barbers own a barbershop their relationship is "owners" even if other barber shop one of them is tenant. If the second barber is always a tenant in owner's barber shop than it's a owner-tenant relationship. Same barber is "same person". Any other relationship remains blank.

I expect the following result:

enter image description here

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@Sasha ,

 

Drag [Barber] from Table2 to Rows and add measure below.

Table2 =
FILTER ( Table1, Table1[Status] = "Owner" )
Measure =
SWITCH (
    TRUE (),
    SELECTEDVALUE ( Table2[Barber] ) = SELECTEDVALUE ( Table1[Barber] ), "Same Person",
    NOT (
        ISEMPTY (
            FILTER (
                Table1,
                Table1[BarberShop] IN VALUES ( Table2[BarberShop] )
                    && Table1[Status] = "Owner"
            )
        )
    ), "Owners",
    NOT (
        ISEMPTY (
            FILTER ( Table1, Table1[BarberShop] IN VALUES ( Table2[BarberShop] ) )
        )
    ), "Owner-Tenant"
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@Sasha ,

 

Drag [Barber] from Table2 to Rows and add measure below.

Table2 =
FILTER ( Table1, Table1[Status] = "Owner" )
Measure =
SWITCH (
    TRUE (),
    SELECTEDVALUE ( Table2[Barber] ) = SELECTEDVALUE ( Table1[Barber] ), "Same Person",
    NOT (
        ISEMPTY (
            FILTER (
                Table1,
                Table1[BarberShop] IN VALUES ( Table2[BarberShop] )
                    && Table1[Status] = "Owner"
            )
        )
    ), "Owners",
    NOT (
        ISEMPTY (
            FILTER ( Table1, Table1[BarberShop] IN VALUES ( Table2[BarberShop] ) )
        )
    ), "Owner-Tenant"
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft  how can I sort the columns of the output in my example so all the the barbers that have "the same" person will appear first similarly to the order they appear in the rows and only after that the rest barbers (that basically only rent) will appear in the columns. In this case, the diagonal will be continuous and this will obviously be more pleasing visually. 

Awesome!

Thanks!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

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

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.