What's the best way to calculate the total number of years/days that a contact has been a member?

For example, say I want to find people who have been a member for more than 10 years, taking gaps into consideration.

I was thinking of a combination of the "civicrm_log_membership" table with a custom field, or maybe the summary-fields extension. By having it in a custom field, it would be easy to expose to the search/reports, and it could be regularly updated using a Scheduled Job.

  • i like the sound of Summary Fields approach – petednz - fuzion Jan 28 at 0:11
  • In this case are you assuming if there is a gap this means there is a new membership? So this would be the sum of the duration of each membership on a contact that doesn't overlap? – Luke Stewart Jan 28 at 1:32
  • I always assumed that a gap would create a new membership, but a colleague insists that this is not always the case. I need to double-check (I would consider it a bug!). – bgm Jan 28 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.