# Mark duplicated values in a power table

**URL:** <https://forum.inductiveautomation.com/t/mark-duplicated-values-in-a-power-table/91314>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [June 3, 2024, 9:54pm UTC](https://forum.inductiveautomation.com/t/mark-duplicated-values-in-a-power-table/91314 "2024-06-03T21:54:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rigoberto.reyes](https://avatars.discourse-cdn.com/v4/letter/r/65b543/32.png) [@rigoberto.reyes](https://forum.inductiveautomation.com/u/rigoberto.reyes)\
**Post date:** [June 3, 2024, 9:54pm UTC](https://forum.inductiveautomation.com/t/mark-duplicated-values-in-a-power-table/91314/1 "2024-06-03T21:54:37Z")

</div>

Hi there.

I´m using a power table to show statistical information and I need to mark duplicated values (same column). How can I do it?

![imagen](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/7/e728a175ca5ff89641a8dda38751585d3ede88d7.png)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 3, 2024, 9:57pm UTC](https://forum.inductiveautomation.com/t/mark-duplicated-values-in-a-power-table/91314/2 "2024-06-03T21:57:13Z")

</div>

Your specification is underdefined.

1. Is it only the UUID column that is to be checked?
2. What is supposed to happen if there are two or more sets of duplicates? Do you need to color each set differently?

---

<div class="post-metadata">

**Author:** ![rigoberto.reyes](https://avatars.discourse-cdn.com/v4/letter/r/65b543/32.png) [@rigoberto.reyes](https://forum.inductiveautomation.com/u/rigoberto.reyes)\
**Post date:** [June 3, 2024, 10:02pm UTC](https://forum.inductiveautomation.com/t/mark-duplicated-values-in-a-power-table/91314/3 "2024-06-03T22:02:36Z")

</div>

Hi.

Only UUID column must be checked and changing color is not needed for more sets of duplicates

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 3, 2024, 10:02pm UTC](https://forum.inductiveautomation.com/t/mark-duplicated-values-in-a-power-table/91314/4 "2024-06-03T22:02:50Z")

</div>

Where is the data coming from?  
Can a duplicate happen anywhere in a given column, or is it guaranteed to be sequential?

It's going to be _very_ expensive to calculate this the naive way (for each row in the table, check every other row for a match), so if you can e.g. run a separate DB query to return the set of duplicate IDs that would help _enormously_.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 3, 2024, 11:23pm UTC](https://forum.inductiveautomation.com/t/mark-duplicated-values-in-a-power-table/91314/5 "2024-06-03T23:23:28Z")

</div>

A query like that shown below would show you the problem items.

```python
SELECT
    max(machine), UUID, COUNT(*)
FROM
    Product
GROUP BY
    UUID
HAVING 
    COUNT(*) > 1

```

Result:

| max(machine) | UUID | COUNT(\*) |
| --- | --- | --- |
| 12705 | 0028185551 | 3 |
| 12704 | 0028185552 | 2 |

You can play with the query on [SQL Fiddle](https://sqlfiddle.com/mysql/online-compiler?id=94f8b945-f0d5-4369-96d3-34149369b521).

---

<div class="post-metadata">

**Author:** ![crees](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@crees](https://forum.inductiveautomation.com/u/crees)\
**Post date:** [June 4, 2024, 3:01pm UTC](https://forum.inductiveautomation.com/t/mark-duplicated-values-in-a-power-table/91314/6 "2024-06-04T15:01:57Z")

</div>

If you just want to count the duplicate UUIDs you could add another column to your source query (assuming its some flavour of SQL)

`COUNT(*) OVER (PARTITION BY UUID) as [Duplicate_Count]`

Anything \> 1 would have duplicates. You could use that column to format the rest of the row, and then hide it.
