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 almost 8 years ago and it was last updated almost 8 years ago.
TotalQuantity = CALCULATE(SUM(Sales[Quantity]), FILTER(Sales, Sales[CustomerId] = EARLIER (Sales[CustomerId])))