Tuesday, February 14, 2012

Design Aggregations using XMLA

How can I automate aggregation design of a cube in Analysis Services

using XMLA.

I tried following XMLA.

I am not getting any examples for XMLA for Aggregation

design, please help me

===================================================

<Execute xmlns="urn:schemas-microsoft-com:xml-analysis">

<Command>

<DesignAggregations>

<Object>

<DatabaseID>Adventure

Works DW</DatabaseID>

<CubeID>Adventure

Works</CubeID>

<MeasureGroupID>Internet

Sales</MeasureGroupID>

<PartitionID>Inernet_Sales_2001</PartitionID>

</Object>

<Time>10</Time>

<Steps>4</Steps>

<Optimization>30</Optimization>

<Storage>100</Storage>

<Materialize></Materialize>

<Queries></Queries>

</DesignAggregations>

</Command>

<Properties>

<PropertyList>

</PropertyList>

</Properties>

</Execute>

===================================================

Regards

SK

Here's a couple of scripts i was mucking around with. i've split them into 1, 2 and 3 (ie numbered in the orderr in which i ran them). They may give you some pointers to where you want to go.

Sorry about the formatting, i've just pasted them in here and it seems to go on forever.....

Script 1 - Create Aggregation Design for Measure Group --

<!--

XMLA_Creates_Aggregation_Design_for_Measure_Group

This script adds the aggregation design to the measure group

-->

<Create xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<ParentObject>
<DatabaseID>Aggregation Testbed</DatabaseID>
<CubeID>Adventure Works</CubeID>
<MeasureGroupID>Internet Sales</MeasureGroupID>
</ParentObject>
<ObjectDefinition><AggregationDesign>

<ID>AggregationDesign 1</ID>

<Name>AggregationDesign 1</Name>

<!-- Parameterize the following element-->

<EstimatedRows>1013</EstimatedRows>

<!-- Load the dimensions and levels and level counts from the Cube_Levels table-->

<Dimensions>

<Dimension>

<CubeDimensionID>Order Date Key - Dim Time</CubeDimensionID>

<Attributes>

<Attribute>

<AttributeID>Date</AttributeID>

<EstimatedCount>1158</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Calendar Year</AttributeID>

<EstimatedCount>4</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Calendar Semester</AttributeID>

<EstimatedCount>7</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Calendar Quarter</AttributeID>

<EstimatedCount>13</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Calendar Month Number</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Calendar Month Name</AttributeID>

<EstimatedCount>38</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Fiscal Year</AttributeID>

<EstimatedCount>4</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Fiscal Semester</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Fiscal Quarter</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Fiscal Month Number</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Fiscal Month Name</AttributeID>

</Attribute>

</Attributes>

</Dimension>

<Dimension>

<CubeDimensionID>Ship Date Key - Dim Time</CubeDimensionID>

<Attributes>

<Attribute>

<AttributeID>Date</AttributeID>

<EstimatedCount>1158</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Calendar Year</AttributeID>

<EstimatedCount>4</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Calendar Semester</AttributeID>

<EstimatedCount>7</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Calendar Quarter</AttributeID>

<EstimatedCount>13</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Calendar Month Number</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Calendar Month Name</AttributeID>

<EstimatedCount>38</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Fiscal Year</AttributeID>

<EstimatedCount>4</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Fiscal Semester</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Fiscal Quarter</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Fiscal Month Number</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Fiscal Month Name</AttributeID>

</Attribute>

</Attributes>

</Dimension>

<Dimension>

<CubeDimensionID>Delivery Date Key - Dim Time</CubeDimensionID>

<Attributes>

<Attribute>

<AttributeID>Date</AttributeID>

<EstimatedCount>1158</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Calendar Year</AttributeID>

<EstimatedCount>4</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Calendar Semester</AttributeID>

<EstimatedCount>7</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Calendar Quarter</AttributeID>

<EstimatedCount>13</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Calendar Month Number</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Calendar Month Name</AttributeID>

<EstimatedCount>38</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Fiscal Year</AttributeID>

<EstimatedCount>4</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Fiscal Semester</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Fiscal Quarter</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Fiscal Month Number</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Fiscal Month Name</AttributeID>

</Attribute>

</Attributes>

</Dimension>

<Dimension>

<CubeDimensionID>Customer</CubeDimensionID>

<Attributes>

<Attribute>

<AttributeID>Full Name</AttributeID>

<EstimatedCount>18484</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Country-Region</AttributeID>

<EstimatedCount>6</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>State-Province</AttributeID>

<EstimatedCount>71</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>City</AttributeID>

<EstimatedCount>587</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Postal Code</AttributeID>

<EstimatedCount>646</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Education</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Email Address</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Gender</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Marital Status</AttributeID>

<EstimatedCount>4</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Occupation</AttributeID>

<EstimatedCount>6</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Phone</AttributeID>

</Attribute>

</Attributes>

</Dimension>

<Dimension>

<CubeDimensionID>Product</CubeDimensionID>

<Attributes>

<Attribute>

<AttributeID>Product Name</AttributeID>

<EstimatedCount>606</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Product Line</AttributeID>

<EstimatedCount>4</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Model Name</AttributeID>

<EstimatedCount>119</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Subcategory</AttributeID>

<EstimatedCount>37</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Category</AttributeID>

<EstimatedCount>4</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>List Price</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Size</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Weight</AttributeID>

</Attribute>

</Attributes>

</Dimension>

<Dimension>

<CubeDimensionID>Currency</CubeDimensionID>

<Attributes>

<Attribute>

<AttributeID>Currency</AttributeID>

<EstimatedCount>105</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Currency Code</AttributeID>

</Attribute>

</Attributes>

</Dimension>

<Dimension>

<CubeDimensionID>Sales Reason</CubeDimensionID>

<Attributes>

<Attribute>

<AttributeID>Sales Reason</AttributeID>

<EstimatedCount>10</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Sales Reason Type</AttributeID>

<EstimatedCount>3</EstimatedCount>

</Attribute>

</Attributes>

</Dimension>

<Dimension>

<CubeDimensionID>Internet Sales Order Details</CubeDimensionID>

<Attributes>

<Attribute>

<AttributeID>Sales Order Key</AttributeID>

<EstimatedCount>60398</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Sales Order Number</AttributeID>

<EstimatedCount>27659</EstimatedCount>

</Attribute>

<Attribute>

<AttributeID>Sales Order Line</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Carrier Tracking Number</AttributeID>

</Attribute>

<Attribute>

<AttributeID>Customer PO Number</AttributeID>

</Attribute>

</Attributes>

</Dimension>

</Dimensions>

</AggregationDesign>

</ObjectDefinition>

</Create>

-- End of script 1 :)

Script 2. - Add/link the aggregation Design to the Measure Group --

<!--

XMLA_Adds_Aggregation_Design_To_Partition

This script adds the aggregation design to the partition. It requires the aggregation design to have been

created for the associated Measure Group

-->

<Alter xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">

<Object>

<DatabaseID>Aggregation Testbed</DatabaseID>

<CubeID>Adventure Works</CubeID>

<MeasureGroupID>Internet Sales</MeasureGroupID>

<PartitionID>Internet_Sales_914</PartitionID>

</Object>

<ObjectDefinition>

<Partition xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<ID>Internet_Sales_914</ID>

<Name>Internet_Sales_914</Name>

<Annotations>

<Annotation>

<Name>LastOrderDateKey</Name>

<Value>914</Value>

</Annotation>

</Annotations>

<Source xsi:type="QueryBinding">

<DataSourceID>AdventureWorksDW</DataSourceID>

<QueryDefinition>SELECT * FROM [dbo].[FactInternetSales] WHERE OrderDateKey &lt;= '184'</QueryDefinition>

</Source>

<StorageMode>Molap</StorageMode>

<ProcessingMode>Regular</ProcessingMode>

<ProactiveCaching>

<SilenceInterval>-PT1S</SilenceInterval>

<Latency>-PT1S</Latency>

<SilenceOverrideInterval>-PT1S</SilenceOverrideInterval>

<ForceRebuildInterval>-PT1S</ForceRebuildInterval>

<Source xsi:type="ProactiveCachingInheritedBinding" />

</ProactiveCaching>

<EstimatedRows>1013</EstimatedRows>

<AggregationDesignID>AggregationDesign 1</AggregationDesignID>

</Partition>

</ObjectDefinition>

</Alter>

-- END OF SCRIPT 2 :)

Script 3. - Run the designer to build the aggregation designs themselves (ie the aggregations, but not populated with data, this happens when you build the partition and/or cube).

<!--

XMLA_Runs_Aggregation_Engine_to_Determine_Aggregations

This script runs the aggregation engine that uses the supplied parameters to build an aggregation design

-->

<DesignAggregations xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">

<Object>

<DatabaseID>Aggregation Testbed</DatabaseID>

<CubeID>Adventure Works</CubeID>

<MeasureGroupID>Internet Sales</MeasureGroupID>

<AggregationDesignID>AggregationDesign 1</AggregationDesignID>

</Object>

<!--Time>00h00m05s</Time-->

<Steps>0</Steps>

<Optimization>25.0</Optimization>

<Materialize>true</Materialize>

</DesignAggregations>

-- END OF SCRIPT 3 :)

Hope you find these of use.

Steve.

No comments:

Post a Comment