Reputation: 159
Im trying to Highlight the row with duplicate values depends upon the count in a specific background color.
for example.
If the no. of duplicate values is 2, the bgcolor in "green".
IF the count is 3, the bgcolor is in "red".
I need the expression for that process.
Any Help!
Upvotes: 1
Views: 6734
Reputation: 355
Right click on the column go to background choose expression copy and paste this code in and change the "COLUMN" to the column name
=IIF(COLUMN = 2, "Green",IIF(COLUMN = 2, "Red","White"))
Upvotes: 0
Reputation: 5542
Ian's answer should be correct. If there's any reason why that doesn't work for you, you can try to use the LookupSet function which returns an array and the length property which returns the size of the array.
On your BackgroundColor property then you can write something like:
=Switch(LookupSet(Fields!ID.Value, Fields!ID.Value, Fields!ID.Value, "dataset").Length = 3, "Red",
LookupSet(Fields!ID.Value, Fields!ID.Value, Fields!ID.Value, "dataset").Length = 2, "Green")
Upvotes: 0
Reputation: 39586
Say I have some simple data like this:
If I'm setting up highlighting based on ID, I would make sure this is a group based on this column, e.g.
Then, for the BackgroundColor property I would use an expression like:
=Switch(Count(Fields!ID.Value, "IDGroup") = 3, "Red"
, Count(Fields!ID.Value, "IDGroup") = 2, "Green")
So for each detail row, count the ID values in the ID group and set the colour accordingly. Works for my data:
Upvotes: 3