A similar question is asked before but it's not working in my dataset.
I have a dataset called "daten" where customers bought more than one item on the same day. I want to count the items bought on the same day by the customer. Each customer has a unique ID, thus I want to create a new variable and sum up the same dates corresponding to the ID number.
The purpose is summing up the item bought on the same day, I don't want to include the day if the user bought an item on a different day.
So the data should look like this with the new variable "number of items" :
Order Date User ID Number of Item
31.05.2016 1 2
31.05.2016 1 2
01.09.2015 1 1
01.06.2017 15 1
07.08.2016 2 3
07.08.2016 2 3
07.08.2016 2 3
I used ave
and aggregate
functions but there must be something wrong in the logic of my code.