cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Conditional Formatting Duplicate Records in Rows

I've been researching this for hours and I've given up. What I need is simple. I just need to apply conditional formatting to any records that match a record in another row. I'm sure this is simple but I'm new to Power BI so I could use some guidance.

 

Here's an example of what I want it to look like. This is a table that shows users logged into computers and how many hours they've been logged in. I'd like to highlight the current user if they are logged into more than one system.

 

sampe2.PNG

1 ACCEPTED SOLUTION
Gordonlilj
Solution Sage
Solution Sage

Hi,

 

If i understand it correctly than this should work.

Create a calculated column

CountDistinct = 
VAR CountDistinct = Table[Current User]
RETURN

CALCULATE(
    COUNTROWS('Table'),
    ALL('Table'),
    Table[Current User] = CountDistinct
)

Replace the table and column with your own and in the conditional format on current use make it look like this

 

Capture.PNG

View solution in original post

9 REPLIES 9
bigtree123
Helper I
Helper I

@Gordonlilj This will not work if there are more than 2 duplicates. How can I achieve this when I have more than 2 duplicates in data?

Gordonlilj
Solution Sage
Solution Sage

Hi,

 

If i understand it correctly than this should work.

Create a calculated column

CountDistinct = 
VAR CountDistinct = Table[Current User]
RETURN

CALCULATE(
    COUNTROWS('Table'),
    ALL('Table'),
    Table[Current User] = CountDistinct
)

Replace the table and column with your own and in the conditional format on current use make it look like this

 

Capture.PNG

Hi, The given solution worked perfectly for me as well. Thanks for that. I am looking for a slight variant, if possible. Is it possible not to highlight only the first record?

Anonymous
Not applicable

Is there an easy way to ignore one particular computer from my table? There's a conference room computer so that's flagging as red but I want it to be ignored.

Sure, all you would need to do is put the code inside an IF statement such as

CountDistinct = 
IF(Table1[System] ="Com5",1,
VAR CountDistinct = Table1[Current User]
RETURN

CALCULATE(
    COUNTROWS('Table1'),
    ALL('Table1'),
    Table1[Current User] = CountDistinct
))
Anonymous
Not applicable

That worked to get rid of the conference room computer but I also need it to remove the formatting from the other computer that the person is logged into. In other words, even though the conference room computer is no longer highlighted, the other computer that the user is logged into is still highlighted in red.

Anonymous
Not applicable

Would this be a simple command to add?

It probably would be simple but could you provide some more sample data? So i could understand the issue better and provide a correct solution

Anonymous
Not applicable

Thank you so much! That worked perfectly 

Helpful resources

Announcements
May 23 2022 epsiode 5 without aka link.jpg

The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through June10th!

Power BI Dev Camp Session 22 without aka link and time 768x460.jpg

Check it Out!

Watch Session 22 Ted's Dev Camp along with past sessions!

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!

Top Kudoed Authors