I have a dataset that has duplicate Invoice Number values.
I need help generating an index column ("Occurrences") to count the number of occurrences of the "InvoiceNo".
Any guidance would be greatly appreciated.
| InvoiceNo | Occurrence |
|---|---|
| 100011 | 1 |
| 100012 | 1 |
| 100013 | 1 |
| 100011 | 2 |
| 100011 | 3 |
| 100012 | 2 |
| 100014 | 1 |
I have tried using code suggested from a similar thread, but it is generating an error. The error says "We cannot convert the value 100011 to type list". However, I'm not sure that the syntax of the code is correct anyway. Appreciate any guidance that you can give. TIA.
let
initialTable = Table.FromColumns(InvoiceNo, type table [Occurrence = text]),
grouped = Table.Group(initialTable, "InvoiceNo", {{"toCombine", each Table.AddIndexColumn(_, "Occurrences", 1, 1), type table}}),
combined = Table.Combine(grouped[toCombine])
in
combined