Hi, I have following Schema below:
For easy to see, here is the structe:
CREATE (:Customer)-[:BUY {InvoiceId, UnitPrice}]->(:Product)
Customer can have many Invoice(:BUY relation ship), I want to find
Which customers increased spending from the first purchase to the last?(Calculate depend on UnitPrice), I'm thinking first finding all (:BUY relationship) of Customers than sort date of those relatationships in Ascending order than get the first element as
FirstBuy and then use
avg() to calculate an average of UnitPrice of all (:BUY relationship) I call this as
AverageBuying , then check
AverageBuying and
FirstBuy if
FirstBuy greater than
AverageBuying mean customer not pay greater after the first buy so I will remove that customer, is this best way? And so can somebody give me example how to implement this, I think this maybe a complex query I'm not sure can write correctly, thanks