Hey everyone,

I have a very easy question, but I am just not solving it. Let's suppose I have two departement with a given variable x. My dataset looks like:


Departement x
1 5
1 7
1 7
2 2
2 2
2 2

Now, I want to create a variable which sums all DISTINCT values of x by departement. So my dataset should look like:

Departement x y
1 5 12
1 7 12
1 7 12
2 2 2
2 2 2
2 2 2

How do I do that?

Best,

Simeon