Simply sum the quantity using a field from the current row as a filter in the table you are summing from
me@jaykilleen.com wrote this over 7 years ago and it was last updated over 7 years ago.
TotalQuantity = CALCULATE(SUM(Sales[Quantity]), FILTER(Sales, Sales[CustomerId] = EARLIER (Sales[CustomerId])))