{"canonical_url":"https://engineer.company/glossary/slowly-changing-dimension/","content_markdown":"# Slowly changing dimension\n\n## What it is\n\nA slowly changing dimension is a set of descriptive records whose attributes can\nchange over time. In a reporting model, a dimension can describe customers,\nplaces, products or organisations. A change may need to update what a report\nsays today, preserve what was true when an event happened, or do both. A slowly\nchanging dimension gives these changes an explicit storage and reporting policy.\n\nOne common policy, called Type 1, overwrites an attribute in the existing\ndimension row. A spelling correction is often suitable for this treatment.\nAnother policy, called Type 2, adds a dimension version for each change that\nshould be visible in history. The versions share a business identifier that\nidentifies the same entity. Each version usually has its own surrogate key, so\nan event can refer to the description in effect at the relevant time. Effective\ndates or timestamps describe when each version applies.\n\nThe policies can differ between attributes of one dimension. A location's\nmisspelled name can be corrected wherever it appears. A change in the region\nresponsible for that location can require history for financial or operational\nreports. Make each choice explicit, because it affects which facts will appear\nunder an old or new value when a report runs.\n\n## Why it matters\n\nConsider a store that belongs to one sales region in January and another in\nFebruary. A report about current management might group both months under\ntoday's region. A report that evaluates regional targets for January needs the\nhistorical region that owned the store when the sales occurred. The same fact\nrecords can support both views if the model preserves the effective assignment\nand provides a way to find the current one.\n\nThe policy also matters when records arrive late. A sales event from January\nmight be delivered after the store changes region. Joining it to the current\nversion would assign the sale to February's organisation. A lookup based on the\nevent date can choose the historical version. This requires matching the model's\ndates to a genuine business rule, such as transaction date or fulfillment date,\nand using that meaning consistently across loading and reporting.\n\nHistory takes more storage and makes each update a larger decision. A Type 2\nload often closes one interval and opens another. Consumers have to know which\nversion of a record they are reading. Record history when it answers a real\nquestion, such as who owned a location at an earlier time. Choose a simpler\noverwrite for a correction that should consistently appear in all reports. The\ndecision is easier to revisit when its reporting purpose is stated beside the\nmodel.\n\n## What it looks like in practice\n\nImagine a warehouse that collects daily usage facts for electricity meter\nlocations. Each location has a stable business code and its regional assignment\ncan change on the first day of a month. The dimension stores a row with the old\nregion and one with the new region. Use a clear interval convention, such as a\nstart that is included and an end that is excluded. This gives a reading on the\ntransition date exactly one eligible interval.\n\nWhen a fact arrives, locate its dimension version from the location code and the\nreading date. Use the version's surrogate key in the fact table, or use an\nequivalent query rule that always selects the historical record. Also decide how\nto represent facts that arrive before a dimension record is available. A\nwarehouse can temporarily place them under a clearly designated unknown member\nand reconcile them after the correct dimension arrives. That behaviour needs to\nbe visible in the pipeline's results and checks.\n\nEngineer's\n[Power BI projects case study](/portfolio/delivered-8-power-bi-projects-with-manuals/)\ndescribes dashboards for real-time and historical electrical and geographical\ndata. The example here illustrates a modelling decision relevant to that kind of\ncomparison. If a past reading and its location's current assignment appear on\nthe same screen, the report labels and joins should make clear whether each\nfigure follows the old region or the current organisation.\n\n## Where it goes wrong\n\nOverlapping effective dates can assign one fact to more than one dimension\nversion. Measuring totals before and after the join is a simple way to detect a\nduplicate assignment. Also test a missing period and the exact boundary value.\nThe former should follow an agreed unknown or rejected-record policy. The latter\nshould match exactly one row. Use the same timezone and date grain on both sides\nof a lookup.\n\nUpdates can be more complicated when correction records arrive out of order.\nSuppose a location actually changed region two weeks before the effective date\nstored in the warehouse. A repair may need to split an existing interval and\nreassign affected facts. Record which reports have already been released and\nwhether they are expected to be restated. A correction mechanism should leave\nenough evidence for a reviewer to explain why a historical figure changed.\n\nThe fact loader and dimension loader can also race. A fact may arrive while the\nnew effective version is still being written. Coordinate the two loads so\nconsumers see a consistent assignment, or publish a bounded reconciliation step\nfor unmatched facts. Replaying the same input should preserve an existing\nversion key where the business change is identical. Stable keys make it easier\nto repair a load without rewriting unrelated historical facts.\n\nFinally, separate genuine change from changes in input formatting. Variations in\ncase, spacing or source codes can generate many unnecessary history rows if a\nloader treats each as a new business assignment. Compare canonical values or use\nan agreed identifier for the relationship. Test one actual transition and one\nrepeated delivery of the same state. These exercises keep the history useful for\nits intended readers and make a later data repair easier to verify.\n\n## Further reading\n\n- [Microsoft Power BI guidance on slowly changing dimensions](https://learn.microsoft.com/en-us/power-bi/guidance/star-schema#slowly-changing-dimensions).\n  Explains Type 1 and Type 2 history in a star schema.\n- [Microsoft Fabric dimension-table modelling](https://learn.microsoft.com/en-us/fabric/data-warehouse/dimensional-modeling-dimension-tables).\n  Describes keys, dimension layouts and history choices.\n- [Microsoft Fabric dimensional table loads](https://learn.microsoft.com/en-us/fabric/data-warehouse/dimensional-modeling-load-tables).\n  Discusses how dimension and fact loading interact.\n\n\u003chttps://engineer.company/glossary/slowly-changing-dimension/\u003e\n","date_modified":"2026-11-25T07:18:46Z","description":"Model a changing assignment in a data warehouse and join historical facts to the version that applied at the time.","formats":{"gemtext":"https://engineer.company/glossary/slowly-changing-dimension/index.gmi","gopher":"https://engineer.company/glossary/slowly-changing-dimension/gophermap","html":"https://engineer.company/glossary/slowly-changing-dimension/","json":"https://engineer.company/glossary/slowly-changing-dimension/index.json","markdown":"https://engineer.company/glossary/slowly-changing-dimension/index.md","pdf":"https://engineer.company/glossary/slowly-changing-dimension/index.pdf"},"kind":"page","language":"en","title":"What is a slowly changing dimension?","url":"https://engineer.company/glossary/slowly-changing-dimension/","version":1}