RSS
热门关键字:  数据挖掘  人工智能  数据仓库  搜索引擎  数据挖掘导论

Calculation on the fly : OLAP by example

来源: 作者:unkonwn 时间:2004-12-11 点击:

 

At the moment our OLAP database is comprised of two data (or measure) cubes, these are the quantity of shoes sold and the value tax exclusive. These measures are dimensioned by Time, Style and Outlet.

数据挖掘研究院

From these two measures we can create others which won′t be stored by the database but will be calculated dynamically each time the user requests them. These measures are sometimes called formulas in reference to the text that defines them. 数据挖掘研究院

From the user′s point of view there is no difference between a stored measure and a formula. Both are defined by dimensions and by type. The formula Average Price, representing the average price of a pair of shoes, is dimensioned according to Time, Style and Outlet and has a decimal type. The formula is the simplest possible and reads:

数据挖掘研究院

Average Price = Total Value Tax Exclusive / Quantity

数据挖掘研究院

As soon as a user requires this variable, the database engine performs the required divisions to create the information. 数据挖掘研究院

It is not necessary for all of the elements of a formula to be dimensioned in the same way. For example we could define a new formula:

Total Value tax Inclusive = Total Value Tax Exclusive x 1.206

Here all the cells are individually multiplied by 1.206.

数据挖掘研究院

As the value added tax (VAT) rate changes (too) frequently, it is possible to create a new variable VAT, dimensioned only by time. This variable will indicate the VAT rate to apply to each position in the Time dimension. We therefore have, still very intuitively:

Total Value Tax Inclusive = Total Value Tax Exclusive x (100+VAT)/100

数据挖掘研究院

Thus, the correct total will be automatically applied to every cell to which this formula applies.

数据挖掘研究院

In the same way, if the VAT rate changes for the different products, the dimensions of the VAT variable must be Time and Product. Graphically, this variable will be a plane instead of a line.

最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
匿名?