Many businesses rely on information in the data warehouse to conduct price waterfall analysis. There is no single way to design a schema to support waterfall analysis; your solution will vary according to the waterfall model being used and the availability of data elements.
Waterfall Analysis
Waterfall analysis represents pricing as a series of "leakages" or deductions from list price, usually grouped into major categories, with various intermediate assessments of price. Target margins are also sometimes included. The journey from "list price" to "pocket margin" may be expressed in terms of unit prices, average unit prices, or as percentages.
In the diagram below, for example, waterfall analysis represents "list price" as 100%. Several types of "leakages" appear as percentage reductions. The various approximations of price are shown in dark blue; leakages are shown in light blue. Targets appear in red.
"Invoice Price," for example is what appears on customer orders, and factors in several discounts. "Net Price" factors in post-order discounts. "Product Price" factors in sales and marketing costs, and "Pocket Margin" is the end result of the analysis.
Supporting from a Dimensional Model
From a dimensional design perspective, waterfall analysis is similar to profitability analysis. There is not a single, "best way" to support waterfall analysis. The sophistication of your solution will vary based on the complexity of the waterfall model and the availability of data.
It is best to start by thinking about the different prices and leakages as additive facts, which implies extended amounts. While prices and leakages can be specified as unit amounts, waterfall analysis is most flexible when it can be conducted across products, time periods or geography. Storing unit amounts in a dimensional schema does not serve this well. Instead, think about the waterfall components as facts that represent extended amounts. These are fully additive, and can be summarized with maximum flexibility. (Some graphics of waterfall analysis use unit amounts, but these are computed based on volume totals, rather than the reverse.)
A Value Chain
If thought of as additive facts, the various prices and leakages can be associated with one or more processes, each potentially represented by a fact table. Together, there fact tables form a value chain, related by a set of common dimensions. By combining the data from these stars, the waterfall can be constructed.
Next, look at your business's waterfall model itself. Are the data elements available? At what level of detail? Do some represent allocations? What are the allocation rules? This will drive the design of stars that capture key components of the waterfall.
In the illustration, the first several columns may be available directly from an order-entry system. We can envision a single order_facts star, which contains facts capturing these extended amounts for each order line: list price, volume discounts, corporate discounts, promotion discounts, and invoice price.
The order entry system may also support rebate processing, allowing the next two facts to be stored in the same table: rebates and net price. Or, it may be that these are computed at different periodicity and/or in a different system, in which case they may belong in a separate star. If stored separately, tying them to the original order will allow them to correlate to an order date rather than the time of the rebate, allowing for "lagged" and "unlagged" flavors of analysis.
Allocations
As in traditional profitability analysis, some components of waterfall analysis may be allocated. Where this occurs, you must be sure that there is a definitive source of data. Alternatively, there must be an agreed upon and consistent set of business rules used to construct allocations. (Remember that data warehouses publish data; they do not manufacture it.)
The example above requires marketing and advertising costs be available by (or allocated to) quarter, product category and region. This may be less granular than the data that supported the columns to their left. Conformed dimensions will ensure that all data can be expressed at a common level of detail.
If there is no source of data or business rule, the desired model cannot and should not be supported by the data warehouse. It is up to the business to develop the processes and systems to define these data elements, not the data warehouse.
Targets
You may also have targets for the various prices, which are specified by planners as percentages. These will also need a home somewhere. They are really non-additive facts, and will likely be stored in fact tables that associate them with time periods and plan version. Alternatively, they may be incorporated into reports by hand.
Pulling it Together
Waterfall analysis reports, like the one above, can be constructed by combining data from the constituent stars and combining it based on the common dimensions (such as products, time, or regions.) This process is sometimes referred to as "drilling across."
It is also possible to construct a single "derived" star (or cube), in which this consolidation is handled in the ETL process, rather than the reporting process. This makes the analysis much easier to perform, since much of the hard work is taken care of in advance.
Variation in the Model
Some businesses have models that vary over time or according to products or categories, and may have support for waterfall analysis incorporated directly into operational systems. This is accomplished on the operational side by setting up a breakdown of each order line according to a set of configurable waterfall components.
Such an operational solution may translate into a dimensional design that represents each transaction line as a series of rows in a single fact table, each line containing a single dollar amount. Each row represents one of the components in the waterfall chart. A dimension determines which component is represented by each row.
This design approach offers nice flexibility, as the model can be changed without altering the design. However, the reports themselves may require alteration as the model is refined. Furthermore, he star itself is limited in its utility; its single fact must be carefully qualified each time it is aggregated.
Friday, July 2, 2010
Wednesday, May 26, 2010
Avoid Using Dates as Keys
Posted by
Chris Adamson
This post explores the impact of using a date as the primary key for a dimension table.
A: It is not absolutely necessary. But you should use a surrogate key anyway. Here's why.
Suppose you have a DAY dimension which contains one row for each calendar date. In addition to the full date, it contains columns that represent the year, quarter, month, day of week, holiday status, and so forth. It also contains columns that represent frequently used combinations of these various attributes.
Users (or developers) can use the columns to do things like filter queries, aggregate facts, sort results, and drive subtotaling. Database administrators can index these columns to optimize these activities.
You might be tempted to use the full date as the primary key of the table. This is urge is understandable -- why bother creating an additional column called DAY_KEY. Seems like extra work for nothing, right?
Consistency and Performance Issues
Remember that the primary key of a dimension table will also appear in fact tables. If a date is used, users or developers will eventually try using it as a "shortcut" in queries, avoiding a join to the DAY table.
This leads to inconsistencies. Developers may mean well, thinking they are "saving a join." But they may apply different rules to compute things like fiscal periods.
Use of a day table guarantees consistent computation of all the characteristics of each day. All the columns are computed exactly once, during the ETL process. Everyone who uses them gets consistent results.
Moreover, avoiding the DAY table may generate performance issues. If a report developer wants to filter for a particular day of the week, they may apply SQL date comparison functions to the day column in the fact table. The database will probably have to make this comparison for each row in the fact table.
A day of the week in the DAY table is far more efficient, because it is pre-computed and indexed.
You may think you can prevent these mishaps. But you cannot. Sooner or later, they will occur. Dates in the fact table will beckon. A user, developer, or consultant will try to take a shortcut. Perhaps under your watch, or perhaps after you have gone.
Guarantee consistency and performance by using a surrogate key.
If you are curious, read on for some other, less important reasons.
Q: I'd like to hear your thoughts on using dates as keys. Is it really necessary to have a surrogate key for a date dimension?
Hartford, CT
A: It is not absolutely necessary. But you should use a surrogate key anyway. Here's why.
Suppose you have a DAY dimension which contains one row for each calendar date. In addition to the full date, it contains columns that represent the year, quarter, month, day of week, holiday status, and so forth. It also contains columns that represent frequently used combinations of these various attributes.
Users (or developers) can use the columns to do things like filter queries, aggregate facts, sort results, and drive subtotaling. Database administrators can index these columns to optimize these activities.You might be tempted to use the full date as the primary key of the table. This is urge is understandable -- why bother creating an additional column called DAY_KEY. Seems like extra work for nothing, right?
Consistency and Performance Issues
Remember that the primary key of a dimension table will also appear in fact tables. If a date is used, users or developers will eventually try using it as a "shortcut" in queries, avoiding a join to the DAY table.
This leads to inconsistencies. Developers may mean well, thinking they are "saving a join." But they may apply different rules to compute things like fiscal periods.
Use of a day table guarantees consistent computation of all the characteristics of each day. All the columns are computed exactly once, during the ETL process. Everyone who uses them gets consistent results.
Moreover, avoiding the DAY table may generate performance issues. If a report developer wants to filter for a particular day of the week, they may apply SQL date comparison functions to the day column in the fact table. The database will probably have to make this comparison for each row in the fact table.
A day of the week in the DAY table is far more efficient, because it is pre-computed and indexed.
You may think you can prevent these mishaps. But you cannot. Sooner or later, they will occur. Dates in the fact table will beckon. A user, developer, or consultant will try to take a shortcut. Perhaps under your watch, or perhaps after you have gone.
Guarantee consistency and performance by using a surrogate key.
If you are curious, read on for some other, less important reasons.
Wednesday, May 19, 2010
Kimball's Approach is Top-Down
Posted by
Chris Adamson
Ralph Kimball's approach to data warehousing is frequently mis-characterized as being "bottom-up." This post aims to clear up that misconception.
Bus Architecture
Kimball's bus architecture (or dimensional data warehouse architecture) is an enterprise architecture. At its core, a set of conformed dimensions ensure a consistent representation of standard terms and data elements across multiple subject areas. The conformed dimensions describe important things like products, customers, locations, or anything of significance to the business.
The subject areas are called data marts. They represent things like manufacturing, sales, invoicing, receivables and so forth. Data marts don't need to be implemented all at once. They can be implemented one at a time, as part of an incremental program. Data marts also don't need to be stored in a single database (although they may.) When they are stored in different databases, the conformance bus ensures consistency and compatibility.
Top-Down
Kimball advocates planning a set of conformed dimensions as an up-front (i.e. strategic) activity. The conformance bus then serves as the blueprint for a set of integrated data marts, which can be built on whatever schedule makes the most sense.
Kimball and Ross put it this way:
Bottom-Up
A bottom-up approach is one that moves in the opposite direction, beginning with a departmental focus and later evolving into one that has an enterprise focus. This occurs when organizations build stand-alone data marts, then later decide to integrate them.
Stand-alone data marts are designed and built for departmental use, without an enterprise context. They are cheaper in the short-run, offering a fast path to quick results. Stand-alone data marts also arrive due to mergers and acquisitions, or through packaged software.
When there is more than one stand-alone data mart, however, they are likely to exhibit incompatibilities and inconsistencies. They are sometimes labeled "stovepipes." Faced with these inconsistent data marts, some organizations resolve to retrofit them into a conformance framework. This can be a difficult and expensive process, requiring extensive rework.
When stand-alone data marts are successfully brought into conformance, a bottom-up path has been followed--one that starts with a departmental solution and moves to enterprise capability. Bottom-up development is cheaper in the short term but more expensive in the long term.
While the end result may be compatible with Kimball's vision, clearly the route is not. If this is news to you, you might want to check out his book. (The link appears beneath the quotation above.) You can also consult posts on data warehouse architectures and common misconceptions.
-- Chris
Bus Architecture
Kimball's bus architecture (or dimensional data warehouse architecture) is an enterprise architecture. At its core, a set of conformed dimensions ensure a consistent representation of standard terms and data elements across multiple subject areas. The conformed dimensions describe important things like products, customers, locations, or anything of significance to the business.The subject areas are called data marts. They represent things like manufacturing, sales, invoicing, receivables and so forth. Data marts don't need to be implemented all at once. They can be implemented one at a time, as part of an incremental program. Data marts also don't need to be stored in a single database (although they may.) When they are stored in different databases, the conformance bus ensures consistency and compatibility.
Top-Down
Kimball advocates planning a set of conformed dimensions as an up-front (i.e. strategic) activity. The conformance bus then serves as the blueprint for a set of integrated data marts, which can be built on whatever schedule makes the most sense.
Kimball and Ross put it this way:
During the limited-duration architecture phase, the team designs a master suite of standardized dimensions and facts that have uniform interpretation across the enterprise...We then tackle the implementation of separate data marts in which each iteration closely adheres to the architecture.Because it begins with an enterprise-level framework, then delivers departmental functionality, this is a top-down approach.
- From The Data Warehouse Toolkit, Second Edition![]()
by Ralph Kimball and Margy Ross (Wiley, 2002)
Bottom-Up
A bottom-up approach is one that moves in the opposite direction, beginning with a departmental focus and later evolving into one that has an enterprise focus. This occurs when organizations build stand-alone data marts, then later decide to integrate them.
Stand-alone data marts are designed and built for departmental use, without an enterprise context. They are cheaper in the short-run, offering a fast path to quick results. Stand-alone data marts also arrive due to mergers and acquisitions, or through packaged software.
When there is more than one stand-alone data mart, however, they are likely to exhibit incompatibilities and inconsistencies. They are sometimes labeled "stovepipes." Faced with these inconsistent data marts, some organizations resolve to retrofit them into a conformance framework. This can be a difficult and expensive process, requiring extensive rework.
When stand-alone data marts are successfully brought into conformance, a bottom-up path has been followed--one that starts with a departmental solution and moves to enterprise capability. Bottom-up development is cheaper in the short term but more expensive in the long term.
While the end result may be compatible with Kimball's vision, clearly the route is not. If this is news to you, you might want to check out his book. (The link appears beneath the quotation above.) You can also consult posts on data warehouse architectures and common misconceptions.
-- Chris
Image: PCI Slot by Ryan_Franklin_az
Licensed under Creative Commons 2.0
Subscribe to:
Posts (Atom)
