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

About the Series …

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.

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

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.

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.

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
to achieve the illustrative needs of a hypothetical client in
Reporting Services.

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.

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
    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),

  • 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.
William Pearson
William Pearson
Bill has been working with computers since before becoming a "big eight" CPA, after which he carried his growing information systems knowledge into management accounting, internal auditing, and various capacities of controllership. Bill entered the world of databases and financial systems when he became a consultant for CODA-Financials, a U.K. - based software company that hired only CPA's as application consultants to implement and maintain its integrated financial database - one of the most conceptually powerful, even in his current assessment, to have emerged. At CODA Bill deployed financial databases and business intelligence systems for many global clients. Working with SQL Server, Oracle, Sybase and Informix, and focusing on MSSQL Server, Bill created Island Technologies Inc. in 1997, and has developed a large and diverse customer base over the years since. Bill's background as a CPA, Internal Auditor and Management Accountant enable him to provide value to clients as a liaison between Accounting / Finance and Information Services. Moreover, as a Certified Information Technology Professional (CITP) - a Certified Public Accountant recognized for his or her unique ability to provide business insight by leveraging knowledge of information relationships and supporting technologies - Bill offers his clients the CPA's perspective and ability to understand the complicated business implications and risks associated with technology. From this perspective, he helps them to effectively manage information while ensuring the data's reliability, security, accessibility and relevance. Bill has implemented enterprise business intelligence systems over the years for many Fortune 500 companies, focusing his practice (since the advent of MSSQL Server 2000) upon the integrated Microsoft business intelligence solution. He leverages his years of experience with other enterprise OLAP and reporting applications (Cognos, Business Objects, Crystal, and others) in regular conversions of these once-dominant applications to the Microsoft BI stack. Bill believes it is easier to teach technical skills to people with non-technical training than vice-versa, and he constantly seeks ways to graft new technology into the Accounting and Finance arenas. Bill was awarded Microsoft SQL Server MVP in 2009. Hobbies include advanced literature studies and occasional lectures, with recent concentration upon the works of William Faulkner, Henry James, Marcel Proust, James Joyce, Honoré de Balzac, and Charles Dickens. Other long-time interests have included the exploration of generative music sourced from database architecture.

Latest Articles