How can I filter the customer who don't buy for a period of time

How can I filter the customer who don't buy for a period of time

My customer should have buy some product again in 6 months to replace the old one. So I want to detect that they  buy from us again or we lose this customer

I want to create one field like  Last Activity time but called Last buy date to collect the date of the latest closed won deals. and if this field is longer than 6 month It will change another field called 'customer loyalty' and change it to we lose this customer.

Please guide me how to setup all of that.

Regards,