How to track each unique customer's purchases over time

15 minutes for the code to run does seem like a long time. It's difficult to say why without seeing it; maybe you could produce a reprex?