MDX Set Functions: The ToggleDrillState() Function

About the Series …

This article is a member of the series, MDX
Essentials
. The series is designed to provide handson
application of the fundamentals of the Multidimensional Expressions (MDX) language,
with each tutorial progressively adding features designed to meet specific
realworld needs.

Virtually all of the MDX we have constructed in earlier
articles can now be used in the SQL Server Management Studio, SQL
Server Business Intelligence Studio
, and various other areas within
the Microsoft integrated Business Intelligence solution, and much of
what we construct going forward can be executed in the Analysis Services
2000
MDX Sample Application (assuming connection to an appropriate Analysis
Services
data source). MDX as a language continues to evolve and expand:
we will focus on many new features in articles to come, while still continuing
to examine business uses of MDX in general. The use of MDX to meet the
realworld needs of our business environments will continue to be my primary
concentration within the MDX Essentials series.

For more information about the series in general, as well as
the software and systems requirements for getting the most out of its member
lessons, please see Set
Functions: The DrillDownMember() Function
,
where important information is detailed regarding the applications, samples
and other components required to complete our practice exercises.

Overview

In
this article, we will continue the examination of "MDX for drilling up
and down
" that we began in Set Functions: The DrillDownMember() Function. We have discussed the nature of drilling,
in general, in previous articles of our subseries, stating that it comprises
an analytical technique through which means an information consumer can
maneuver between summarized ("drilling up") and detailed ("drilling
down
") levels of data. We noted that either of drilling up or drilling
down occurs along the lines of drilling paths that are defined within
the structure of our cubes, and which are typically specified by the cube’s dimensional
hierarchies
. We mentioned, too, that these paths can be based upon
alternative relationships that exist within or between dimensions.

To repeat an example I have used to illustrate the general
concept, drilling down might be described as follows, based upon an engagement
within which I have recently been involved: An executive within a state Department
of Education
wishes to examine annual Adequate Yearly Progress (AYP)
data within a cube constructed primarily to allow comparison and analysis of
those results at various levels. The executive can examine national averages,
numbers of test takers, and various other measures, and then perform a
drilldown operation within a Geography dimension that might then present
the data by states. He could then perform subsequent drilldowns to
display state regions (or perhaps even congressional districts), counties
/ school systems, and more. Depending upon the design of the cube, the drilldown
process could ultimately take the consumer to the level of the individual schools
– perhaps even to the individual students themselves.

Drilling up is a capability that might be taken for
granted in a drilldown scenario such as the foregoing. From any of the drilled
down
levels at which the information consumer finds himself or herself, a
corresponding capability to navigate upward, from more detailed
levels of data to more summarized levels of data, would be an
expected complementary feature.

In the earlier articles, Set
Functions: The DrillDownMember() Function
and Set
Functions: The DrillUpMember() Function
,
we introduced the "primary," memberdirected MDX drilldown functions,
DrillDownMember() and DrillUpMember(), respectively. In this
article, we will examine a function, ToggleDrillState(), that compounds
the actions of these two functions, and whose objective, like that of most of
the other drill functions that we have examined within this series, is to serve
as a mechanism to transform the actions of information consumers, within an end
user application (at, say, the reporting layer), into a corresponding MDX
operation.

In a
manner similar to that of other functions that we have examined in the MDX
Essentials
series, ToggleDrillState() can be useful in a host of
different reporting and analysis applications. Along with other "navigational"
functions like it (virtually all of which we examine in other articles of this
series) ToggleDrillState() allows us to exercise a great deal
of presentation sleight of hand, in working with MDX in Analysis Services,
as well as within Reporting Services and various other reporting
applications that can access an Analysis Services cube. Like other MDX functions in general, the ToggleDrillState() function can be leveraged, within
and among the various "layers" of the Microsoft integrated
Business Intelligence solution
, to support sophisticated presentations and
features. We will introduce the function, commenting upon its operation and
touching upon examples of effects that we can employ it to deliver. As a part
of our discussion, we will:

  • Examine the syntax surrounding the function;

  • Undertake illustrative examples of the uses of the function in
    practice exercises;

  • Briefly discuss the results datasets we obtain in the practice
    examples.
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