Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum Rss Feed

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
Free Newsletters:

News Via RSS Feed

Rss Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles


Posted May 16, 2005

MSSQL Server Reporting Services : Mastering OLAP Reporting: Ad Hoc TopCount and BottomCount Parameters

By William Pearson

About the Series ...

This article is a member of the series MSSQL Server Reporting Services. The series is designed to introduce MSSQL Server Reporting Services ("Reporting Services"), with the objective of presenting an overview of its features, together with many tips and techniques for real-world use. For more information on the series, as well as the hardware / software requirements to prepare for the exercises we will undertake, please see my initial Database Journal article, A New Paradigm for Enterprise Reporting.

As I have stated since the charter article of the series, published about the time Reporting Services was first publicly released, my conviction is that Reporting Services will commoditize business intelligence, particularly in its role as a component in an integrated Microsoft BI solution. Having been impressed from my first exposure to this exciting application, when it was in early beta, my certainty in its destiny grows stronger by the day, as I convert formerly dominant enterprise Business Intelligence systems, such as Cognos, Business Objects, Crystal, and others, to the Reporting Services architecture. I receive constant requests to conduct strategy sessions about these conversions with large organizations in a diverse range of industries - the interest grows daily as awareness of the solution becomes pervasive. Indeed, the six-plus figures that many can shave from their annual IT budgets represent a compelling sweetener to examining this incredible toolset.

Basic assumptions underlying the series are that you have correctly installed Reporting Services, including Service Pack 1, along with the applications upon which it relies, and that you have access and the other rights / privileges required to complete the steps we undertake in my articles. For details on the specifics of the adjustments necessary to quickly allow full freedom to complete the exercises in this and subsequent articles, as well as important assumptions regarding rights and privileges in general, please see earlier articles in the series, as well as the Reporting Services Books Online.

About the Mastering OLAP Reporting Articles...

As I have noted in many articles and presentations, one of the first things that becomes clear to "early adopters" of Reporting Services is that the "knowledgebase" for OLAP reporting with this tool is, to say the least, sparse. (I recently heard an internal "reporting guru" say, during a BI strategy session with a major soft drink manufacturer in Atlanta, that "we didn't evaluate Reporting Services because it doesn't do cubes ...") As most of us are aware, minimal, if any, attention is given to using Analysis Services cubes as data sources for reports in the handful of books that have been published on Reporting Services to date. All are written from the perspective of relational reporting, as if with existing popular tools for that purpose. One Reporting Services book discusses OLAP reporting with Reporting Services, and then performs illustrative exercises with Office Web Components (OWC), instead. Another depicts an MDX snippet at the end of the book, as if as an afterthought. All of the early books focus entirely on relational reporting, and most make heavy use, typically enough, of the Books Online and other scraps of documentation that we already have anyway. (I could go on, but my overall opinion of the technical book industry is already well known.)

As I stated in my article, Mastering OLAP Reporting: Cascading Prompts, the purpose of the Mastering OLAP Reporting subset of my Reporting Services series is to focus on techniques for using Reporting Services for OLAP reporting. In many cases, which I try to outline in my articles at appropriate junctures, the functionality of well-established, but expensive, solutions, such as Cognos PowerPlay, can be met in most respects by Reporting Services - at a tiny fraction of the cost. The vacuum of documentation in this arena to date, represents a serious "undersell" of Reporting Services, from an OLAP reporting perspective. I hope to contribute to making this arena more accessible to everyone, and to share my implementation and conversion experiences as the series evolves. In the meantime, rest assured that the OLAP potential in Reporting Services will be yet another reason that the application "commoditizes" Business Intelligence.


As we have discussed elsewhere in the series, parameters (sometimes known as "prompts" or "parameter prompts") are a staple of enterprise reporting, because they enable information consumers to quickly find the information they need from a data source. These filters / members can be put in place "on the fly," and are typically enacted when the consumer types or selects a value, or a series of values, at run time.

We discussed the two primary types of parameters, type-in and picklist, in Mastering OLAP Reporting: Cascading Prompts, where we concluded that a well-constructed picklist is often the tool of choice, because of its inherent elimination of typing errors. Because it is important to always anticipate information consumer needs, I maintain an "inventory" of successful approaches (I come across such nuances frequently as a BI architect and consultant) to meeting the "need for user friendliness." In working with MSAS, I have found countless opportunities to "embed" support for such instrumentality at the MSAS level.

In this article, I will present a "combined approach" for the support of a top- or bottom- count picklist in the reporting environment. This option will enable an information consumer to decide, on the fly, whether a "top" or "bottom" query is more appropriate, as well as to input the number of top / bottom members they wish to retrieve. After constructing its foundation within the context of the underlying Dataset within Reporting Services, I will show the use of a picklist in conjunction with a type-in parameter to achieve the illustrative needs of a hypothetical client in Reporting Services.

Some of the general concepts in this article extend to any enterprise reporting package designed to report from Analysis Services OLAP cubes, assuming that they provide a means for stringing and passing MDX in a manner similar to that we are about to undertake. It is especially applicable in the cases of tools like Crystal Analysis Pro, ProClarity and other advanced, yet relatively "open," OLAP reporting applications. Suffice it to say that if you can successfully designate an Analysis Services cube as a data source, and can pass direct MDX to Analysis Services from the reporting application, you can probably employ the concepts we will be discussing here.

In this article, we will:

  • Create copies of both an existing sample OLAP report and an Analysis Services sample cube, to save time while preserving the respective original samples;
  • Provide an overview of the TopCount() and BottomCount() MDX functions, prior to introducing a hypothetical need for their use in an OLAP report;
  • Create calculated members and a named set within our clone cube, to support a hierarchical picklist for Time dimension member specification in Reporting Services;
  • Modify the clone report to more closely meet the new presentation specifications of a hypothetical group of information consumers;
  • Explain the MDX that we employ at both the cube (to support hierarchical date parameterization), and at the report (to support TopCount() and BottomCount() parameterization), levels;
  • Create parameters within our new OLAP report to support the selection of a hierarchical Time dimension specification; as well as "top" or "bottom", along with the number of the top / bottom members, as report retrieval options;
  • Preview the report in Report Designer, supplying run-time parameters, to verify its operation.

MS SQL Archives

Latest Forum Threads
MS SQL Forum
Topic By Replies Updated
SQL 2005: SSIS: Error using SQL Server credentials poverty 3 August 17th, 07:43 AM
Need help changing table contents nkawtg 1 August 17th, 03:02 AM
SQL Server Memory confifuration bhosalenarayan 2 August 14th, 05:33 AM
SQL Server Primary Key and a Unique Key katty.jonh 2 July 25th, 10:36 AM