Feb 11, 2022 01:02 AM
Background: I have a table that includes a list of activities each customer has done. So there unique value is a random “Event ID”, another column is “Customer ID” and a third column is called “Activity Type.”
I need to find a way to count how many times a Customer has done a certain Activity Type and then be able to use that formula to create a notification when a customer has their FIRST activity (first appears in the table.) The table is populated via API, so it’s not as simple as just knowing I did it. I found a Pivot table that can just give me the counts of Activity Type by Customer, but you can’t act on any of the information in that table. So essentially I need a way to find any time a new record is created that contains a unique Customer ID that does not exist yet in the table.
TL,DR: I need a way to answer the question “Tell me when a new client has their first activity”.
Feb 11, 2022 01:42 AM
Hey @Jeffrey_Porter,
welcome to Airtable community.
To do those calculations I recommend to change the structure of your base like this:
→ To answer the question “How many times customer done the activity X” you need to add rollup field in customers table. In this rollup you will set a condition to of activity is the activity X you want to present. Then aggregate the with: COUNTALL(values)
→ To answer the question “Tell me when a new client has their first activity” you need
IF(REGEX_MATCH({activities},"activity X")=1,LAST_MODIFIED_TIME(activities),BLANK())
{activities} is the link to field between activities and customers tables
Of course we could recommend an other and more efficient way to run those calculations and of course a better base structure but this is a simple fast solution I could recommend.
For any further question please feel free to text back.
Yours sincerely,
Dimitris Goudis
Feb 11, 2022 01:47 AM
Thank you for getting back to me. Unfortunately, I’m unable to rebuild our current table / infrastructure. I do have a separate table of all customers, so I’m able to have a table of “All Activities” and a separate one of “All Customers” but we can’t manually link them - we would need that to happen automatically. When the “Activities” table is automatically populated, it does come in with both Activity ID and Customer ID, so if there’s a way to match Customer ID from that table and Customer ID from the customer table, and automatically link, this could work. thoughts?
Feb 11, 2022 10:34 AM
It is totally possible to achieve that via simple automation.
Here’s the logic flow (as I imagine it).
There are some things to keep in mind with this configuration.
Firstly, this relys on there always being an associated customer in the table that will match the customer ID from the new activity record.
Second, you need to create a backstop that will account for situations where the customer either (1) does not exist, or (2) dirty data entry means that customer IDs are incorrectly entered and cause a break in the link.
My recommendation is to create a conditional automation that says that if the search for a customer returns false, then fire off an email or Slack message to let you know that a new activity record was created, but did not return a customer search result based on the customer ID.
This will allow you to easily troubleshoot when it does occur.