Databases Reference
In-Depth Information
Listing 7.1 shows the definition of a measure in XML. The default value for the
AggregateFunction property is SUM . (It's the one that is most commonly used.) If you use a
different aggregation than SUM , you must specify it; you don't need to specify SUM .
NOTE
Analysis Services has default values for all the measure properties.
LISTING 7.1
A Definition of the Store Sales Measure
<Measure>
<ID>Store Sales</ID>
<Name>Store Sales</Name>
<Source>
<DataType>Double</DataType>
<Source xsi:type=”ColumnBinding”>
<TableID>dbo_sales_fact_1997</TableID>
<ColumnID>store_sales</ColumnID>
</Source>
</Source>
</Measure>
The AggregateFunction and DataType measure properties define the behavior of the
measure. These two properties are related to each other, so it's a good idea to keep one
property in mind when you define the other. Let's look at each aggregation and the data
type for it.
SUM
For the SUM aggregation, the value of the measure is calculated by adding together the data
on the various levels. For example, the sales in our sample model are defined by summing;
to determine the sum of sales for this year, we sum the sales made during each quarter of
the year.
Any integer data type works for SUM , but it's important to pay attention to the size of the
data for this type so that you don't get overflow from the summing of large numbers.
When you use float numbers, you don't usually get overflow, but performance can suffer
and you can lose precision to the point that it affects the results of your analysis. For our
Store Sales measure, the data type is Currency . The data maintains greater precision, and
it won't overflow; the Currency data type can hold huge numbers, enough to hold the
sum of sales in most models.
 
Search WWH ::




Custom Search