Navigating the SVB collapse: Three SQL queries that helped us overcome uncertainty at Y42
Sometimes, there are these moments when everything seems to be on the line. Last weekend, this moment came for thousands of companies when a liquidity issue at Silicon Valley Bank spiraled into a full-blown bank run and ended in the collapse of the bank.
I won't discuss what companies should do to prevent this level of exposure in the future and how this should not have happened in the first place โ all of this will be discussed far and wide. And hindsight is always 20/20.
At Y42, similar to many other European growth companies, we were exposed to SVB's demise. And while we had 7+ bank accounts across the organization, we had a significant deposit with SVB, which meant that we immediately had to move to protect the company.
As a growing analytics company, and thanks to our amazing Finance and Business Operations teams (shoutout to Elena and Simran), we recently finished a project where we brought all our financial transactions across the whole organization at Y42 into our data warehouse. There, we structured it into a ready-to-analyze data mart.
Originally, this project was created as a puzzle piece for our larger analytics efforts and to measure our efficiency. However, when the time came, unforeseen use cases emerged.
So here is how things went down:
March 9, evening: We learned about the SVB stock crash, and solving the game theory easily leads to the conclusion that most people would act on a bank run (there is virtually no individual upside to keeping money in, there is a huge potential downside if you do) โ unless there is a concerted effort to stop this from happening.
March 10, late night: The Bank of England announced its plan to place SVB UK into bank insolvency.
March 11, morning: Communication with the board about exposure, several update calls. Fortunately, unlike other companies, we were not "only" banking with SVB but had several other operational bank accounts. This gave us breathing room to operate.
๐ There is no one official playbook on how to do emergency cash management in growth companies. However, there are a few key principles one can adhere to:
Prio 1: Always, always people and payroll first. We have to protect the heart of any company by putting people first. Besides, there are also huge liability implications if managed wrongly. Also consider cash preservation by deferring payments for specific groups (CEO first, then senior leadership team)
Prio 2: Protect key relationships. There are those vendor relationships that are commoditized, and there are those that brought you to where you are. This is the time to show how we value relationships during bad times.
Prio 3: Only then consider all other payments.
March 11, 14.30: Whatโs the size of your payroll?
Obviously, I have a rough number in mind, but in this context, being wrong by 1% can have dire consequences. It is not a particularly easy question to answer, given we have payroll running across multiple countries and all types of different setups with different providers. However, based on our data mart, we were able to skip hours of putting together different spreadsheets to get a precise number on how much cash we would need.
SELECT
DATE_TRUNC(date, MONTH) AS __timestamp,
P_L_Category___Level_2 AS P_L_Category___Level_2,
SUM(amount) AS Amount
FROM y42analytics.Models_SQL_mrt_expenses
WHERE
date >= CAST('2022-09-01' AS DATE)
AND date < CAST('2023-02-01' AS DATE)
AND meta_category IN ('people')
AND meta_subcategory IN ('PTE', 'FTE')
GROUP BY
P_L_Category___Level_2,
__timestamp
This number is the foundation of all cash planning โ it covers Prio 1.
March 11, 16.00: What are your top non-people expenses?
Again, we all have a good intuition of the top-10 items on this list. However, a company large enough works with hundreds or thousands of vendors across different departments.
SELECT
DATE_TRUNC(date, MONTH) AS date,
name AS name,
cost_center_name AS cost_center_name,
SUM(amount) AS SUM
FROM
y42analytics.Models_SQL_mrt_expenses
WHERE
date >= CAST('2022-01-01' AS DATE)
AND date < CAST('2023-03-12' AS DATE)
AND meta_category IN ('spend')
GROUP BY
date,
name,
cost_center_name
ORDER BY
AVG(amount) DESC
LIMIT 10000;
I poured the output into a pivot table to get a quick global overview over whatโs happening.
With this table, we can make quick decisions on what vendors are a priority, vs what vendors we would have to defer if it came to it. Using the BigQuery connector to Google Sheets, we were able to easily use this as an operational interface to make decisions.
March 11, 16.30: Avoid any surprises โ map out all one-off and annual payments that could happen in the next 30 - 60 days.
The trickiest part was probably to get a full list of all one-off and annual payments. This would be a massive amount of work to do manually. Fortunately, we can again write a query for this task, and in this case, I enlisted ChatGPTโs help to write the query for me and speed up the process.
WITH VendorTransactions AS (
SELECT
name AS VendorName,
COUNT(*) AS TransactionCount,
SUM(amount) AS TotalAmount,
MAX(date) AS LastPaymentDate
FROM `y42analytics`.`Models_SQL_mrt_expenses`
WHERE
date >= '2021-01-01' AND
date < '2023-03-12' AND
meta_category IN ('spend')
GROUP BY
name
),
FilteredVendors AS (
SELECT
VendorName,
TransactionCount,
TotalAmount,
LastPaymentDate
FROM VendorTransactions
WHERE
TransactionCount >= 1 AND TransactionCount <= 2
)
SELECT
VendorName,
TransactionCount,
TotalAmount,
LastPaymentDate
FROM FilteredVendors
ORDER BY TotalAmount DESC;
This overview helps us identify annual obligations and saves us a lot of time walking through individual contracts/invoices.
All of this would not have been possible without our bizops data pipeline thatโs running. We will introduce our data pipeline and the underlying data structure that enabled all this in another blog post.
These queries showcase how to kickstart an emergency cash plan. There was a lot more to be done โ communicating with the team, investors, and banks โ and also in executing a potentially impactful plan. Fortunately, thousands of companies, ourselves included, didnโt have to go down this route seeing as the FDIC stepped in for SVB US and the HSBC for SVB UK.
Having access to the right prepared data and being able to query it from every possible perspective instilled a lot of confidence. Last weekend, it preserved critical energy for decision-making. Ultimately, it helped make the company more resilient during a highly adverse period.
Appendix:
Diagram of our BizOps & Finance data Pipeline using Y42โs data lineage feature.