Forum Discussion
estt
3 years agoFrequent Visitor
Column with sum of distinct values
Hello, i need help to make a column that sum the numbers in the column tp_kmro, based on the column id_pref. In the column id_pref i have the id and this id repeats lots of times ex:
| id_pref | tp_kmro |
| 1 | 2 |
| 1 | 2 |
| 1 | 2 |
| 2 | 4 |
| 2 | 4 |
| 3 | 5 |
i made a column based on id_pref with distinct values so the new id_pref is now:
| 1 |
| 2 |
| 3 |
Now i need to make a new column tp_kmro with the sum of all values in this column
example: sum all values in tp_kmro and put next to id_pref .
like this:
| id_pref | tp_kmro |
| 1 | 6 (2+2+2) |
| 2 | 8 (4+4) |
| 3 | 5 (5) |
Can someone help with this please?