# Duplicate Invoices (similarities in the invoice amount)

**URL:** <https://forum.knime.com/t/duplicate-invoices-similarities-in-the-invoice-amount/75059>\
**Category:** KNIME Analytics Platform\
**Created:** [November 7, 2023, 6:14pm UTC](https://forum.knime.com/t/duplicate-invoices-similarities-in-the-invoice-amount/75059 "2023-11-07T18:14:18Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![DA2023](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@DA2023](https://forum.knime.com/u/DA2023)\
**Post date:** [November 7, 2023, 6:14pm UTC](https://forum.knime.com/t/duplicate-invoices-similarities-in-the-invoice-amount/75059/1 "2023-11-07T18:14:18Z")

</div>

Good evening everybody,

I’m working on a workflow that helps identifying duplicate invoices/payments.

Basically, there has to be a check for every invoice (each row in one column) in an excel file. The transaction should be considered as a “duplicate”, if: the “Vendor ID”, “Invoice Number” and “Invoice Date” are identical (exact match) and the “Invoice Amount in EUR” is “similar”.

Here, “similar” describes three possible scenarios (a kind of fuzzy logic):

1. The “Invoice Amount in EUR” differs ± 3% from each other (another invoice),
2. The “Invoice Amount in EUR” is exactly twice as high as the other (e.g. 50.15 and 100.30).
3. The “Inoice Amount in EUR” begins with the same first four digits (123.45 and 1,234.5).

It would be great, if the output could be similar to the “duplicate row filter”, with the duplicate classifier (chosen and duplucate) and duplicate identifier (e.g. row 12), so that the duplicates can be extracted and displayed seperately (e.g. for internal audit purposes).

Unfortunately, I have no idea on how to realize the “similar” criteria, as I don’t know how to do the check for each individual row in the column (check for all invoices, from invoice to invoice) and hope that someone can help.

Many Thanks in advance & best regards!

---

<div class="post-metadata">

**Author:** ![Kazimierz](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/k/cdc98d/32.png) [@Kazimierz](https://forum.knime.com/u/Kazimierz)\
**Post date:** [November 8, 2023, 7:42am UTC](https://forum.knime.com/t/duplicate-invoices-similarities-in-the-invoice-amount/75059/2 "2023-11-08T07:42:17Z")

</div>

Hello @DA2023

I have no ready-to-use solution; just two thoughts:

1. I would use ‘Duplicate Row Filter’ to identify invoices with identical ‘Vendor ID’, ‘Invoice Number’ and ‘Invoice Date’ columns.
2. Then, I would:

- Make sure amount in ‘Invoice Amount in EUR’ is a number.
- Calculate 3% variation.
- Change numbers to strings.
- Remove special characters like commas, dots, or any others, but keep the original values.
- Change strings back to numbers.
- Check if values meet conditions you mentioned: doubled values or with identical beginning.

Please treat this as inspiration for next trials.  
Good luck,  
Kaz

---

<div class="post-metadata">

**Author:** ![DA2023](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@DA2023](https://forum.knime.com/u/DA2023)\
**Post date:** [November 8, 2023, 3:34pm UTC](https://forum.knime.com/t/duplicate-invoices-similarities-in-the-invoice-amount/75059/3 "2023-11-08T15:34:43Z")

</div>

Hello @Kazimierz

many Thanks for your help!

My problem is that I don’r really know, how to define a check from invoice to invoice. The invoices have to be compared to each other. The problem is that I don’t know, how to do that in KNIME.

Best regards,  
DA

---

<div class="post-metadata">

**Author:** ![rfeigel](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/r/7ea924/32.png) [@rfeigel](https://forum.knime.com/u/rfeigel)\
**Post date:** [November 8, 2023, 4:15pm UTC](https://forum.knime.com/t/duplicate-invoices-similarities-in-the-invoice-amount/75059/4 "2023-11-08T16:15:10Z")

</div>

Can you share a data set?

---

<div class="post-metadata">

**Author:** ![DA2023](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@DA2023](https://forum.knime.com/u/DA2023)\
**Post date:** [November 8, 2023, 4:33pm UTC](https://forum.knime.com/t/duplicate-invoices-similarities-in-the-invoice-amount/75059/5 "2023-11-08T16:33:32Z")

</div>

Hi @rfeigel

unfortunately, I am not allowed to use the real data. But I have created an excel table. Here, I have tried to implement the patterns, I would like to search for. Hope that helps.

Best regards  
DA  
[Test Data.xlsx](https://forum.knime.com/uploads/short-url/2h6khiWal0KSrTxi5AZWAUOEYzR.xlsx) (11.5 KB)

---

<div class="post-metadata">

**Author:** ![hmfa](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/h/9fc29f/32.png) [@hmfa](https://forum.knime.com/u/hmfa)\
**Post date:** [November 8, 2023, 7:18pm UTC](https://forum.knime.com/t/duplicate-invoices-similarities-in-the-invoice-amount/75059/6 "2023-11-08T19:18:06Z")

</div>

Hi @DA2023.

I produced this workflow for you.

[Duplicate Invoices.knwf](https://forum.knime.com/uploads/short-url/vNmJijIBy1aBU2ZAUifryYtjleW.knwf) (94.9 KB)

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/f/0/f032ad1695c886bace22eea2e72d29ff4b7a801c.png)

Hope it helps.  
Br

---

<div class="post-metadata">

**Author:** ![DA2023](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@DA2023](https://forum.knime.com/u/DA2023)\
**Post date:** [November 9, 2023, 3:40pm UTC](https://forum.knime.com/t/duplicate-invoices-similarities-in-the-invoice-amount/75059/7 "2023-11-09T15:40:33Z")

</div>

Hi @hmfa

it works perfectly well, many Thanks for your support!

Just for my understanding: with the “Counter Generation” & “Joiner” nodes you have duplicatet the input in order make it comparible to each other, right? Can you tell, where I can find additional info regarding coding in the “Column Espressions” node?

Best regards  
DA

---

<div class="post-metadata">

**Author:** ![hmfa](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/h/9fc29f/32.png) [@hmfa](https://forum.knime.com/u/hmfa)\
**Post date:** [November 9, 2023, 4:14pm UTC](https://forum.knime.com/t/duplicate-invoices-similarities-in-the-invoice-amount/75059/8 "2023-11-09T16:14:44Z")

</div>

Hi @DA2023

Yes, you are right.  
The counter generation serves to uniquely identify each invoice.  
The joiner relates the table to itself, to compare each invoice to all others from the same supplier and date, including itself.  
Finally, it excludes lines where an invoice compares to itself because it is no exception (same counter).

The column expressions node is very powerful.

You can find more information about JAVA script rules here.

> **[JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript)**
>
> JavaScript (JS) is a lightweight interpreted (or just-in-time compiled) programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js,...

Br  
Hugo

---

<div class="post-metadata">

**Author:** ![DA2023](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@DA2023](https://forum.knime.com/u/DA2023)\
**Post date:** [November 10, 2023, 12:24pm UTC](https://forum.knime.com/t/duplicate-invoices-similarities-in-the-invoice-amount/75059/9 "2023-11-10T12:24:37Z")

</div>

Hi @hmfa ,

many Thanks for the Infio & your support!

Have a nice day & enjoy your weekend.

Best regards,  
DA

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [November 17, 2023, 12:25pm UTC](https://forum.knime.com/t/duplicate-invoices-similarities-in-the-invoice-amount/75059/10 "2023-11-17T12:25:08Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
