Introduction to MSSQL Server 2000 Analysis Services: Manage Distinct Count with a Virtual Cube - Page 6February 14, 2005 11. Type the following into the Virtual Cube Name box: Customer Sales After we create a virtual cube, we must process it before client applications can browse it. The necessary internal links to the specified dimensions and measures in the underlying cubes are established through processing the virtual cube. While the linking operation that is involved in processing is typically quick in itself, we need to keep in mind that initialization of processing of our virtual cube will automatically trigger the processing of any underlying cubes that themselves require processing. This can add significant time to the update, and needs to be included in planning when taking the virtual cube route. Ideally, the underlying cubes will be preprocessed, but this is certainly not a requirement, and may not even be the best strategy, in certain situations. 12. Ensure that the Process Now radio button is selected (the default). This, the last step of the Virtual Cube Wizard, presents us with the option to process the virtual cube now, or at a later time. The Finish the Virtual Cube Wizard dialog, with our selections, appears as depicted in Illustration 27.
13. Click Finish. After clicking Finish above, we see that the Process dialog appears just as it did when we processed the DISTINCT_CUSTOMER cube earlier, logging the significant processing events, then rapidly presenting a green Processing Completed Successfully message at the bottom of the dialog, as shown in Illustration 28.
14. Click Close. The Process dialog closes, and the Virtual Cube Editor (a customized version of the Cube Editor, which has no Schema tab, as does the standard Cube Editor) appears, as partially depicted in Illustration 29.
15. Select File --> Exit from the Virtual Cube Editor main menu to close the Virtual Cube Editor. We are returned to the main Analysis Manager console window. 16. Expand the Cubes folder, if necessary, once again. We see the Customer Sales cube appear, as shown in Illustration 30.
Analysis Manager identifies virtual cubes with the "double" cube icon, as circled in red above. 17. Exit Analysis Services, as desired. Verification with MDX Let's return to the MDX Sample Application, and resurrect our earlier query to execute it against the new virtual cube, taking the following steps: 1. Start the MDX Sample Application. 2. Click OK at the Connect dialog. The MDX Sample Application window appears. 3. Ensure that FoodMart 2000 is selected as the database name in the DB box of the toolbar. 4. Select the Customer Sales virtual cube in the Cube drop-down list box. 5. Select File --> Open, and locate and select the query we created and saved as ANSYS32-1 in the earlier section. The query appears in the Query pane. 6. Expand Measures -> Measures Level in the Metadata tree, exposing the new Distinct Customers measure (from the DISTINCT_CUSTOMERS cube). The MDX Sample Application - Metadata tree (left section of the Metadata pane) should resemble that partially depicted in Illustration 31, complete with the measures from both physical cubes combined in the Customer Sales virtual cube displaying in the Metadata tree (left section of the Metadata pane).
We will make a couple of modifications to the query, and then execute it against the new virtual cube. 7. Change the first line of the query (the comment line) to the following: --ANSYS32-2 Distinct Customer Dataset with Isolated DISTINCT Cube 8. Select File -> Save As ... 9. Save the query as ANSYS32-2, to protect ANSYS32-1. 10. Remove the following (the first calculated member definition within the WITH clause)
MEMBER
[Measures].[Distinct Customers]
AS
'COUNT(CrossJoin({[Unit Sales]},
Descendants ([Customers].CurrentMember,
[Customers].[Name])), ExcludeEmpty)'
11. Change the cube name in the FROM clause from [Sales] to [Customer Sales] The query is now pointed toward our new virtual cube. The modified query appears as shown in Illustration 32.
12. Execute the query using the Run Query button. The results dataset appears as partially depicted in Illustration 33.
We notice, after clicking Run Query, that the query runs and data is returned appreciably faster than the initial query we created in the first section of this article. This is because only the new DISTINCT_CUSTOMERS cube is subjected to the intensive portion of processing required to return the detailed set needed by the calculations we have put into place. The DISTINCT_CUSTOMERS cube, with only one measure, is much smaller than the Sales cube, so less processing is necessary to render the contextually important distinct count within our query. As we see, the results are identical to those of our initial query, with all that remains being to format the Avg Sales per Customer calculated measure, if we choose to do so. There are more actions we can take within our current scenario, where we created the virtual cube, containing the DISTINCT_CUSTOMERS cube, which isolates the Distinct Count, to further increase performance. In our next article, we will examine a further step to leverage the solution we explored in this article to provide a higher degree of performance enhancement within the context of using distinct counts. ConclusionIn this article, we extended our previous introduction to DISTINCT COUNT, and examined one approach to its efficient use within our applications. We focused upon the optimization of DISTINCT COUNT through the isolation of the distinct count measure into a separate cube, and showed how this "best practice" can help us to achieve our objectives with enhanced performance. As in the other articles of our series, we set the stage by providing a hypothetical business requirement. We then examined a way to meet the requirement with an MDX query that contained DISTINCTCOUNT() in a calculated member, and that used a single cube as a data source. We noted query performance, and set about to improve it via the creation of a separate DISTINCT_CUSTOMERS cube, which we designed to house the distinct count attributes of our solution. We then "married" the DISTINCT_CUSTOMERS cube to the initial cube data source through the creation of a virtual cube. Finally, we targeted the virtual cube with the query we had set out to improve, as a means of confirming that performance can be enhanced through the forehanded use of an isolated distinct count cube in scenarios with similar business requirements. » See All Articles by Columnist William E. Pearson, III Discuss this article in the MSSQL Server 2000 Analysis Services and MDX Topics Forum. Introduction to MSSQL Server Analysis Services Series
Introduction to Security in Analysis Services
Cube Storage: Planning Partitions from a SQL Server Management Studio Perspective Cube Storage: Planning Partitions (Business Intelligence Development Studio Perspective) Cube Storage: Introduction to Partitions Introduction to Cube Storage Attribute Discretization: Customize Grouping Names Attribute Discretization: Using the "Clusters" Method Attribute Discretization: Using the "Equal Areas" Method Attribute Discretization: Using the Automatic Method Introduction to Attribute Discretization More Exposure to Settings and Properties in Analysis Services Attribute Relationships Attribute Relationships: Settings and Properties Introduction to Attribute Relationships in MSSQL Server Analysis Services Attribute Member Values in Analysis Services MSSQL Analysis Services - Attribute Member Names Attribute Member Keys - Pt II: Composite Keys Attribute Member Keys - Pt 1: Introduction and Simple Keys Dimension Attributes: Introduction and Overview, Part V Dimension Attributes: Introduction and Overview, Part IV Dimension Attributes: Introduction and Overview, Part III Dimension Attributes: Introduction and Overview, Part II Dimension Attributes: Introduction and Overview, Part I Dimensional Model Components: Dimensions Part II Dimensional Model Components: Dimensions Part I Manage Unknown Members in Analysis Services 2005, Part II Manage Unknown Members in Analysis Services 2005, Part I Alternatively Sorting Attribute Members in Analysis Services 2005 Introduction to Linked Objects in Analysis Services 2005 Distinct Counts in Analysis Services 2005 Positing the Intelligence: Conditional Formatting in the Analysis Services Layer Administration and Optimization: SQL Server Profiler for Analysis Services Queries Mastering Enterprise BI: Time Intelligence Pt. II Mastering Enterprise BI: Time Intelligence Pt. I Design and Documentation: Introducing the Visio 2007 PivotDiagram Actions in Analysis Services 2005: The URL Action Actions in Analysis Services 2005: The Drillthrough Action Mastering Enterprise BI: Introducing Actions in Analysis Services 2005 Mastering Enterprise BI: Introduction to Translations Mastering Enterprise BI: Introduction to Perspectives Introduction to the Analysis Services 2005 Query Log Mastering Enterprise BI: Working with Measure Groups Mastering Enterprise BI: Introduction to Key Performance Indicators Mastering Enterprise BI: Extend the Data Source with Named Calculations, Pt. II Mastering Enterprise BI: Extend the Data Source with Named Calculations, Pt. I Process Analysis Services Objects with Integration Services Usage-Based Optimization in Analysis Services 2005 Introduction to MSSQL Server Analysis Services: Named Sets Revisited Introduction to MSSQL Server Analysis Services: Migrating an Analysis Services 2000 Database to Analysis Services 2005 Introduction to MSSQL Server Analysis Services: Introducing Data Source Views Introduction to MSSQL Server Analysis Services: Reporting Options for Analysis Services Cubes: MS Excel 2003 and More ... Introduction to MSSQL Server Analysis Services: Mastering Enterprise BI: Create Aging "Buckets" in a Cube Introduction to MSSQL Server Analysis Services: Mastering Enterprise BI: Relative Time Periods in an Analysis Services Cube, Part II Introduction to MSSQL Server Analysis Services: Mastering Enterprise BI: Relative Time Periods in an Analysis Services Cube Introduction to MSSQL Server Analysis Services: Process Analysis Services Cubes with DTS Introduction to MSSQL Server Analysis Services: Presentation Nuances: CrossTab View - Same Dimension Introduction to MSSQL Server Analysis Services: Point-and-Click Cube Schema Simplification Introduction to MSSQL Server 2000 Analysis Services: Manage Distinct Count with a Virtual Cube Introduction to MSSQL Server 2000 Analysis Services: Distinct Count Basics: Two Perspectives Introduction to MSSQL Server 2000 Analysis Services: Semi-Additive Measures and Periodic Balances Introduction to MSSQL Server 2000 Analysis Services: Performing Incremental Cube Updates - An Introduction Introduction to MSSQL Server 2000 Analysis Services: Partitioning a Cube in Analysis Services - An Introduction Introduction to MSSQL Server 2000 Analysis Services: Basic Storage Design Introduction to MSSQL Server 2000 Analysis Services: Derived Measures vs. Calculated Measures Introduction to MSSQL Server 2000 Analysis Services: Creating a Dynamic Default Member Introduction to MSSQL Server 2000 Analysis Services: Another Approach to Local Cube Design and Creation Introduction to MSSQL Server 2000 Analysis Services: Introduction to Local Cubes Introduction to MSSQL Server 2000 Analysis Services: Actions in Virtual Cubes Introduction to MSSQL Server 2000 Analysis Services: Putting Actions to Work in Regular Cubes Introduction to MSSQL Server 2000 Analysis Services: Reporting Options for Analysis Services Cubes: ProClarity Part II Introduction to MSSQL Server 2000 Analysis Services: Reporting Options for Analysis Services Cubes: ProClarity Professional, Part I Introduction to MSSQL Server 2000 Analysis Services: Using Calculated Cells in Analysis Services , Part II Introduction to MSSQL Server 2000 Analysis Services: Using Calculated Cells in Analysis Services, Part I Introduction to MSSQL Server 2000 Analysis Services: MSAS Administration and Optimization: Toward More Sophisticated Analysis Introduction to MSSQL Server 2000 Analysis Services: MSAS Administration and Optimization: Simple Cube Usage Analysis Introduction to MSSQL Server 2000 Analysis Services: Build a Web Site Traffic Analysis Cube: Part II Build a Web Site Traffic Analysis Cube: Part I Reporting Options for Analysis Services Cubes: Cognos PowerPlay Reporting Options for Analysis Services Cubes: MS FrontPage 2002 Reporting Options for Analysis Services Cubes: MS Excel 2002 Introduction to MSSQL Server 2000 Analysis Services: Drilling Through to Details: From Two Perspectives Introduction to MSSQL Server 2000 Analysis Services: Custom Cubes: Financial Reporting - Part II Introduction to MSSQL Server 2000 Analysis Services Custom Cubes: Financial Reporting (Part I) Introduction to SQL Server 2000 Analysis Services: Exploring Virtual Cubes Introduction to SQL Server 2000 Analysis Services: Working with the Cube Editor Introduction to SQL Server 2000 Analysis Services: Parent-Child Dimensions Introduction to SQL Server 2000 Analysis Services: Handling Time Dimensions Introduction to SQL Server 2000 Analysis Services: Working with Dimensions Introduction to SQL Server 2000 Analysis Services: Creating Our First Cube |