The CustomerId column combines transactions over time into a single
grouping, the customer (or household or similar entity). How is this
accomplished? It all depends on the business and the business processes:
The purchases might contain name and address information. So,
purchases with matching names and addresses would have the same
customer ID.
The purchases might all have telephone numbers or email address, so
these could provide the customer ID.
Customers may have loyalty cards or account numbers which provide the
customer ID.
The purchases might be on the web, so browser cookies and logins could
identify customers over time.
The purchases might all be by credit card, so purchases with the same
credit card number would have the same customer ID.
Of course, any combination of these or other methods might be used to
generate an internal customer id. And, because any one of these ids could
change over time, the problem has a time component as well.
And all these approaches have their challenges. What happens when a
customer browses on a tablet as well as a laptop (and different cookies are
stored on different machines) or deletes her web cookies? Or when customers
forget their loyalty cards (so the loyalty numbers are not attached to the
purchases)? Or move? Or change phone numbers or email addresses? Or
change their names? Keeping track of customers over time can be challenging.