I have a dataset with 6 columns. I want to have a column which has the count of rows having the same 4 column values (column1 to column 4 should match). Any thoughts to achive this?.
Example:
Number | Column 1 | Column 2 | Column 3 | Column 4 | Column 5 | Column 6 |
123456 | 1 | 1 | 1 | 1 | 1 | 6 |
123457 | 1 | 1 | 1 | 1 | 4 | 24 |
123458 | 1 | 1 | 1 | 1 | 56 | 336 |
123459 | 1 | 1 | 1 | 1 | 7 | 42 |
123460 | 1 | 1 | 1 | 1 | 8 | 48 |
123461 | 2 | 2 | 2 | 2 | 1 | 6 |
123462 | 2 | 2 | 2 | 2 | 4 | 24 |
123463 | 2 | 2 | 2 | 2 | 56 | 336 |
123464 | 2 | 2 | 2 | 2 | 7 | 42 |
123465 | 2 | 2 | 2 | 2 | 8 | 48 |
123466 | 2 | 2 | 2 | 2 | 4 | 24 |
123467 | 2 | 2 | 2 | 2 | 56 | 336 |
123468 | 2 | 2 | 2 | 2 | 4 | 24 |
Output:
Number | Column 1 | Column 2 | Column 3 | Column 4 | Column 5 | Column 6 | Count |
123456 | 1 | 1 | 1 | 1 | 1 | 6 | 5 |
123460 | 1 | 1 | 1 | 1 | 8 | 48 | 5 |
123461 | 2 | 2 | 2 | 2 | 1 | 6 | 8 |
123462 | 2 | 2 | 2 | 2 | 4 | 24 | 8 |
123457 | 1 | 1 | 1 | 1 | 4 | 24 | 5 |
123458 | 1 | 1 | 1 | 1 | 56 | 336 | 5 |
123463 | 2 | 2 | 2 | 2 | 56 | 336 | 8 |
123464 | 2 | 2 | 2 | 2 | 7 | 42 | 8 |
123459 | 1 | 1 | 1 | 1 | 7 | 42 | 5 |
123465 | 2 | 2 | 2 | 2 | 8 | 48 | 8 |
123466 | 2 | 2 | 2 | 2 | 4 | 24 | 8 |
123467 | 2 | 2 | 2 | 2 | 56 | 336 | 8 |
123468 | 2 | 2 | 2 | 2 | 4 | 24 | 8 |