Previous article in the series
As I wrote previously we have ended up with a cobbled together, very light weight Metrics Layer capability in the AgileData Information Platform and its time to refactor it to reuse the new Google Cloud BigQuery Graph with Measures capability.
Before we start that work it makes sense to do a stocktake of the current state so I can determine what we hope we can move and what I am guessing we will leave where it currently is.
Context is King
Before I jump into describing the current state, first a little context on the concepts and terminology I will use as part of these articles.
Facts, Measures, Metrics
Most people use these three terms interchangeably, I know I often do without thinking.
So the Agile Data Guide definitions:
A Fact is a recorded value.
It happened, its stored somewhere, its immutable, it won’t change, it’s not calculated. An order amount of $42.50 is a Fact.A Measure is a basic calculation over Facts.
A sum, an average, a count. Total revenue is a Measure, it’s every order amount summed up.A Metric is a formula, combining Facts or Measures.
Revenue growth is a Metric, it's this month's total revenue minus last month's, divided by last month's.
Facts are stored. Measures and Metrics are calculated.
These definitions are important when I think about what we will be moving to BigQuery Graph, my guess is we will be moving the Measures and the Metrics, but not the Facts.
AgileData Layered Data Architecture
We operate an opinionated Layered Data Architecture in the AgileData Information Platform, this is a Principle with a set of supporting Policies and Patterns which we decided 8 years ago when we started designing and building.
Our data moves through these layers and each layer has a specific set of data work it enables, as well as the Policies that reinforce those isolation of concerns, and the Patterns that make those layers automated.
History is the storeroom.
It keeps the data as the source system sent it, with every change. Every version of an order is in there, all changes over time, stored forever, immutable, never changed.Designed is the kitchen.
It shapes the data into the things the Organisation manages and cares about, a Customer, an Order, a Product, and what happens between them. It holds Concepts, Details and Events (Relationships).Consume is the restaurant.
It holds denormalised wide tables or views that are ready to read, and each one answers a subset of Business Question. For example Orders, with the customer and product details already on them.Then there is the last mile, the tools a person or a machine uses.
That’s an AgileData Information Product, or a third-party tool like Google Data Studio, PowerBi or an Agent.
There are two more layers, Landing sits before History and Cached sits after Consume, but we don’t need to worry about them for this McSpikey (Well I don’t think we do, not actually sure about Cached we will see).
The layers matter here because of where the numbers end up.
Facts are stored in the Designed layer.
Where the Measures and Metrics get calculated is where it currently gets very messy, and that’s the bit we are trying to simplify.
If you want more detail on the Policies and Patterns we have set for these layers, we’ve open sourced a Layered Data Architecture Checklist app on the Agile Data Guides GitHub. The demo runs in your browser and comes loaded with the AgileData reference data layer architecture, so you can see the Patterns we use. (I need to get around to updating it with examples of our Policies as well)
https://github.com/AgileDataGuides/layered-data-architecture-checklist
https://agiledataguides.github.io/layered-data-architecture-checklist/
Our Current State Stocktake
Ok now we have that context lets explore the current messy state.
Definitions for Facts, Measures and Metrics are in Google Spanner
We follow a Principle of Context is our Pet and code/execution is our Cattle. So we store all our definitions in Google Spanner in what we call our Context Plane. We then hydrate the things we need from this Context when we need them.
We store the definitions of Facts in a Pattern Template format we call a Data Dictionary. We store the definitions of Measures and Metrics in a pattern Template format we call a Metrics Tree.
We have stated to work on storing the definition of “things”, Concepts etc, in a Pattern Template format we call a Glossary, but we haven’t finished that work, and so haven’t refactored how those definitions fit with the Fact, Measure and Metrics definitions in the Data Dictionary or Metrics Tree.
We want to keep this “Define Once, Reuse Often” pattern as part of the move to BigQuery Graph. BigQuery Graph should be treated as Cattle not a Pet.
Definitions are surfaced multiple ways
We surface these definitions in our AgileData App and Information Products.
These definitions are accessible via our API’s and MCP tools, so they are available to any GenAI tools and to ADI within the AgileData App and Information Products.
We need to retain this multiple access pattern for definitions when we add BigQuery Graph.
We define and execute Measures and Metrics multiple ways
Some Measures and Metrics calculations are defined via Change Rules and executed and stored in the Designed Layer. Typically these are calculations that don’t need to be called dynamically by the last mile tools and so the calculated results can be static.
Some Measures and Metrics are defined as calculated columns on a Consume Tiles. Think of these as views, so it doesn’t store anything and is calculated on demand when that Tile (View/Table) is queried. Typically these are calculations that need to honour the filters that are being applied in the query that is being executed on that Tile (table/view).
We also use an Activity Schema in the Designed Layer which is defined via Change Rules. These automagically create Consume Tiles (Views). We use this pattern to provide templated Measures and Metrics for common first seen, last seen, time between types of Business Questions.
We also embed some calculations directly in the Information Product themselves, which of course means those calculations are siloe’d from any other reuse. We mitigate this slightly by always pushing the defintion of those calculations back to the Metrics Tree in the Context Plane, and so can force some limited reuse of the definitions when we want to adopt them in other Information Products. But ideally we want reuse of the calculations themselves not just the definitions.
This is the messy stuff we are hoping to refactor using BigQuery Graph.
Facts, Measures and Metric results are surfaced multiple ways
Just like the way we surface the definitions to multiple tools, we do the same for the results of the calculations for those things.
We surface them via the Information Products and also via our MCP, so GenAI tools can reuse them.
We also want other last mile tools and platforms, Google Data Studio, Microsoft PowerBI, Tableau, Omni etc to be able to reuse these definitions and calculation / execution capability as well.
We want to retain this capability when we move to BigQuery Graph
Joins are an Anti-Pattern
We surface all our Consume Tiles using a One Big Table pattern either as physical tables or views by default.
So we denormalise the Designed data into long and wide tables / views.
This reduces the need to use joins across these Consume Tiles.
When we need to do joins as an exception we will either create a new Consume Tile, via a Change Rule, that does the join, or define the join in a specific Information Product.
Im not sure where this one will end up when we adopt to BigQuery Graph.
Current State is Complex
Lots of moving parts, lots of complexity.
Lets count them.
Definitions for Numbers are defined / stored in three places, Glossary, Metrics Tree and Data Dictionary.
Numbers are calculated / stored in four places, Designed Layer, Activity Schema in Designed Layer, Consume Tiles and Information Products.
None of this was a mistake. Each piece was made based on trade-off decisions on how we could build that capability at the time, we built little bits when we had to.
Our architectural Principle is to reuse Google Cloud Serverless Services and so we have been waiting for a Google Cloud Service that would provide a Metrics Layer capability we could adopt.
Three places to define a number and four places to calculate a number is the complexity we want to simplify using BigQuery Graph.
Agile-tecture Future State
Here is where I think BigQuery Graph is going to end up, time will tell.
Layered Data Architecture View
There is poetic license in that diagram as BigQuery Graph with Measures doesn’t actually execute the calculations, it passes the query back to BigQuery itself to execute.
But its an Agile-tecture diagram for a McSpikey and so that poetic license is fine for now.
Do we refactor the Consume Layer completely
One of the unanswered questions we have is can we completely refactor the Consume layer using BigQuery Graph.
Having a separate Consume and Serving layers doesn’t make sense to me.
But the key to any McSpikey (research spike) is to limited the number of uncertainties we want to try and remove without boiling the ocean.
So for now we will focus on moving the calculations for Measures and Metrics to BigQuery Graph.






