Lesson 4-3 - Automatically Grouping Attribute Members
APPLIES TO:SQL Server Analysis ServicesAzure Analysis Services
When you browse a cube, you typically dimension the members of one attribute hierarchy by the members of another attribute hierarchy. For example, you might group customer sales by city, by product purchased, or by gender. However, with certain types of attributes, it is useful to have Microsoft Analysis Services automatically create groupings of attribute members based on the distribution of the members within an attribute hierarchy. For example, you can have Analysis Services create groups of yearly income values for customers. When you do this, users who browse the attribute hierarchy will see the names and values of the groups instead of the members themselves. This limits the number of levels that are presented to users, which can be more useful for analysis.
The DiscretizationMethod property determines whether Analysis Services creates groupings, and determines the type of grouping that is performed. By default, Analysis Services does not perform any groupings. When you enable automatic groupings, you can allow Analysis Services to automatically determine the best grouping method based on the structure of the attribute, or you can choose one of the grouping algorithms in the following list to specify the grouping method:
Analysis Services creates group ranges so that the total population of dimension members is distributed equally across the groups.
Analysis Services creates groups by performing single-dimensional clustering on the input values by using the K-Means clustering method with Gaussian distributions. This option is valid only for numeric columns.
After you specify a grouping method, you must specify the number of groups, by using the DiscretizationBucketCount property. For more information, see Group Attribute Members (Discretization)
In the tasks in this topic, you will enable different types of groupings for the following: the yearly income values in the Customer dimension; the number of employee sick leave hours in the Employees dimension; and the number of employee vacation hours in the Employees dimension. You will then process and browse the Analysis Services Tutorial cube to view the effect of the member groups. Finally, you will modify the member group properties to see the effect of the change in grouping type.
Grouping Attribute Hierarchy Members in the Customer Dimension
In Solution Explorer, double-click Customer in the Dimensions folder to open Dimension Designer for the Customer dimension.
In the Data Source View pane, right-click the Customer table, and then click Explore Data.
Notice the range of values for the YearlyIncome column. These values become the members of the Yearly Income attribute hierarchy, unless you enable member grouping.
Close the Explore Customer Table tab.
In the Attributes pane, select Yearly Income.
In the Properties window, change the value for the DiscretizationMethod property to Automatic and change the value for the DiscretizationBucketCount property to 5.
The following image shows the modified properties for Yearly Income.
Grouping Attribute Hierarchy Members in the Employee Dimension
Switch to Dimension Designer for the Employee dimension.
In the Data Source View pane, right-click the Employee table, and then click Explore Data.
Notice the values for the SickLeaveHours column and the VacationHours column.
Close the Explore Employee Table tab.
In the Attributes pane, select Sick Leave Hours.
In the Properties window, change the value for the DiscretizationMethod property to Clusters and change the value for the DiscretizationBucketCount property to 5.
In the Attributes pane, select Vacation Hours.
In the Properties window, change the value for the DiscretizationMethod property to Equal Areas and change the value for the DiscretizationBucketCount property to 5.
Browsing the Modified Attribute Hierarchies
On the Build menu of SQL Server Data Tools (SSDT), click Deploy Analysis Services Tutorial.
When deployment has successfully completed, switch to Cube Designer for the Analysis Services Tutorial cube, and then click Reconnect on the Browser tab.
Click the Excel icon, and then click Enable.
Drag the Internet Sales-Sales Amount measure to the Values area of the PivotTable Field List.
In the field list, expand the Product dimension, and then drag the Product Model Lines user hierarchy to the Row Labels area of the field list.
Expand the Customer dimension in the field list, expand the Demographic display folder, and then drag the Yearly Income attribute hierarchy to the Column Labels area.
The members of the Yearly Income attribute hierarchy are now grouped into six buckets, including a bucket for sales to customers whose yearly income is unknown. Not all buckets are displayed.
Remove the Yearly Income attribute hierarchy from the columns area and remove the Internet Sales-Sales Amount measure from the Values area.
Add the Reseller Sales-Sales Amount measure to the data area.
In the field list, expand the Employee dimension, expand Organization, then drag Sick Leave Hours to Column Labels.
Notice that all sales are made by employees within one of two groups. Notice also that the employees with 32 - 42 sick leave hours made significantly more sales than employees with 20 - 31 sick leave hours.
The following image shows sales dimensioned by employee sick leave hours.
Remove the Sick Leave Hours attribute hierarchy from the column area of the Data pane.
Add Vacation Hours to the column area of the Data pane.
Notice that two groups appear, based on the equal areas grouping method. Three other groups are hidden because they contain no data values.
Modifying Grouping Properties and Reviewing the Effect of the Changes
Switch to Dimension Designer for the Employee dimension, and then select Vacation Hours in the Attributes pane.
In the Properties window, change the value of the DiscretizationBucketCount property to 10.
On the Build menu of SQL Server Data Tools, click Deploy Analysis Services Tutorial.
When deployment has successfully completed, switch back to Cube Designer for the Analysis Services Tutorial cube.
Click Reconnect on the Browser tab, click the Excel icon, and then reconstruct the PivotTable so that you can view the effect of the change to the grouping method:
Drag Reseller Sales-Sales Amount to Values
Drag Vacation Hours (in the Employees Organization folder) to Columns
Drag Product Model Lines to Rows
Notice that there are now three groups of members of the Vacation Hours attribute that have sales values for products. (The other seven groups contain members with no sales data.)