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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
daxn00b
Frequent Visitor

Find 2 matching strings in different rows with same ID?

Hello Everyone,

 

I'm trying to figure out how to get the count of unique computer_ids that have 2 different strings in different rows. For example, if computer_id = color[red] AND color[green] THEN count 1. The example below should equate to a count of 2.

 

idcolorcomputer_id
1red101
2red102
3red103
4green101
5green102
6yellow103

 

Thanks in advance for any help!

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @daxn00b 

 

Please try the below measure.

 

Red and Green =
VAR redcom =
SUMMARIZE ( FILTER ( ALL ( Data ), Data[color] = "red" ), Data[computer_id] )
VAR greencom =
SUMMARIZE ( FILTER ( ALL ( Data ), Data[color] = "green" ), Data[computer_id] )
RETURN
COUNTROWS ( INTERSECT ( redcom, greencom ) )

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi,
You can also try the following measure to get the same result.
ResultCount =
COUNTROWS(
INTERSECT(
CALCULATETABLE(VALUES(Data[computer_id]),Data[Color] = "green"),
CALCULATETABLE(VALUES(Data[computer_id]),Data[Color] = "red")
))

Same method, I have implemented in the following video.

daxn00b
Frequent Visitor

@Jihwan_Kim Wow, thanks for this! Works great!

Jihwan_Kim
Super User
Super User

Hi, @daxn00b 

 

Please try the below measure.

 

Red and Green =
VAR redcom =
SUMMARIZE ( FILTER ( ALL ( Data ), Data[color] = "red" ), Data[computer_id] )
VAR greencom =
SUMMARIZE ( FILTER ( ALL ( Data ), Data[color] = "green" ), Data[computer_id] )
RETURN
COUNTROWS ( INTERSECT ( redcom, greencom ) )

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 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.