Skip to main content
Question

Count number of duplicate items in metric

  • December 17, 2024
  • 1 reply
  • 130 views

Spandan98
Master Author
Forum|alt.badge.img+10

Hello Pigment Community,

I’m currently facing an issue with counting duplicate items in Pigment. As shown in the image below, I’ve successfully extracted words from a sentence. Now, I’d like to conditionally format and highlight repeated words starting from their second occurrence.

I understand that using a counter to track how often a word appears is key here, but I’m struggling to come up with the correct formula to achieve this.

Could someone kindly guide me on how to proceed? Your help would be greatly appreciated!

Thanks in advance!
 

 

1 reply

CDALMAY
Master Helper
Forum|alt.badge.img+14
  • Master Helper
  • December 17, 2024

Here’s how I would approach it:

  1. Create a new metric: RunningTrim

    • Use the following formula to concatenate all the previous Trim items.
    • Notes : I’ve added a logic to ensure we remove any leading or trailing commas for a cleaner result, but the formula could be simplified.
  2. Create a boolean metric: Check

    • Use the following formula.

       

  3. Apply conditional formatting on Trim based on the Check value equals to TRUE. It will highlight cells you expected.

 

Let me know if this helps or if you need further clarification!