Skip to content

Audit Dimension ​

An audit dimension records the processing context associated with a fact row, such as the ETL code version, source system, and data quality outcomes.

The fact table stores audit keys alongside its other foreign keys. For facts that can be updated, using separate creation and update audit keys preserves both contexts.

Batch Operations

The fact table stores the created_etl_run_id and updated_etl_run_id directly. This lets you identify rows by their creation or most recent update without joining the audit dimension. Both columns are initially set to the first run ID, and any later updates change only the updated_etl_run_id.

These columns make batch selection and reprocessing straightforward. However, because they only track the most recent update, rolling back a specific change requires saved previous values or rebuilding the affected facts from your source history.

Fact Table:

transaction_iddate_keyamountcreated_etl_run_idupdated_etl_run_idcreated_audit_keyupdated_audit_key
TXN-12320260101$100RUN-8841RUN-8841AUD-5AUD-5
TXN-12420260101$250RUN-8841RUN-8902AUD-5AUD-9
TXN-12520260101$80RUN-8841RUN-8841AUD-6AUD-6

Audit Dimension:

audit_keyetl_run_idetl_versionload_timestampsource_systemquality_flag
AUD-5RUN-8841v1.4.22026-01-01 02:00:00POSClean
AUD-6RUN-8841v1.4.22026-01-01 02:00:00POSCurrency defaulted
AUD-9RUN-8902v1.4.32026-01-02 02:00:00POSClean

Grain ​

Instead of a separate row for every fact, the audit dimension holds one row for each unique set of audit details. For example, a single process that loads a million clean rows will generate just one audit row shared by all of them. A new dimension row is created only when an attribute changes, such as a different run, source system, or quality outcome.

In the example above, AUD-5 and AUD-6 belong to the same initial run, but AUD-6 exists because the quality flag differs. AUD-9 was created later when a new run updated an existing transaction.

Creating a unique audit row for every fact row would make the dimension table as large as the fact table itself.

What It Enables ​

Since this acts as a standard dimension table, you can easily group and filter quality metadata. You can break down total sales by the quality_flag to see how much revenue relies on defaulted values. You can also trace a disputed number back to the exact run that produced it or identify exactly which rows were written by a buggy code version.

Keep the flags coarse

Your quality_flag should use a small set of broad categories like Clean or Currency defaulted. Avoid highly specific values like exact percentages. Having too many unique values causes the dimension table to grow out of control. If you need numeric scores, group them into a few distinct buckets.