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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

HELP: Compare 2 columns on same visual where relationship is many to many

I want to compare 2 columns on same visual at a row by row level, if the name matches I want to either only show the columns that match, or at least mark them with a "yes" in a new column:

 

The relationship between both tables is Many to Many. I AM LOOKING FOR A SOLUTION WHICH DOESNT CHANGE THIS.

 

Basically in the below Visual, the columns of Sales person and User who did activity come from different tables with Many to Many relationship. All I want is that if Sales person says the same thing as User who did activity, then to mark it as "yes", or that the visual would only show those that match. (Expected result: row 1, 4, 7, 9 marked as "Yes" to match)

In excel I would simply add a new column and use =if(Sales person = User who did activity,"Yes", "No") ...but powerbi wont allow this because of the many to many relationship....and wont allow to use related function either.

RowSales PersonSales Persons CustomersUser who did activity
1ACustomer 1A
2ACustomer 1B
3ACustomer 1C
4ACustomer 2A
5ACustomer 2B
6BCustomer 1A
7BCustomer 1B
8BCustomer 2A
9BCustomer 2B

There has to be a "dumb" way to do this without going into the relationships!

 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Refer to the measure below.

Measure = 
var a = SELECTEDVALUE('Table 1'[Sales Person])
var b = SELECTEDVALUE('Table 2'[User who did activity])
return
IF(a=b&&NOT(ISBLANK(a))&&NOT(ISBLANK(b)),"yes",BLANK())

2.PNG

3.PNG 

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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
amitchandak
Super User
Super User

@Anonymous , is your issue resolved?

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @Anonymous ,

 

Refer to the measure below.

Measure = 
var a = SELECTEDVALUE('Table 1'[Sales Person])
var b = SELECTEDVALUE('Table 2'[User who did activity])
return
IF(a=b&&NOT(ISBLANK(a))&&NOT(ISBLANK(b)),"yes",BLANK())

2.PNG

3.PNG 

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @Anonymous ,

 

can you provide sample data for the two tables?

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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