MDX Essentials: Set Functions: The DRILLDOWNMEMBERTOP() and DRILLDOWNMEMBERBOTTOM() Functions
December 5, 2005
About the Series ...
This article is a member of the series, MDX Essentials. The series is designed to provide hands-on application of the fundamentals of the Multidimensional Expressions (MDX) language, with each tutorial progressively adding features designed to meet specific real-world needs.
For more information about the series in general, as well as the software and systems requirements for getting the most out of the 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.
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 discussed the nature of drilldown, in our last article, 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 drilling up or down occurs along the lines of drilling paths that are defined within the structure of our cubes, and which are often 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.
We introduced the "primary" MDX drilldown function, DrillDownMember(), stating that it supports the capability of Analysis Services to meet the common need for drilldown. Through our overview, discussion, examination of the syntax, and hands-on practice session with the function, we discovered how DrillDownMember() drills down to the members within a specified primary set that are present within a specified second set. We focused on several ways to leverage the function in our queries and, ultimately, in reporting and other end applications, to meet the business needs of organizational information consumers.
In this article we will examine two specialized set functions that are based upon the principles underlying DrillDownMember(). DrilldownMemberTop() and DrilldownMemberBottom() are both similar to the DrilldownMember() function. However, instead of behaving like DrilldownMember(), in its inclusion of all children in a specified primary set that also exist in a specified secondary set, DrilldownMemberTop() returns the topmost (specified) number of child members for each member, while the DrilldownMemberBottom() function returns the bottommost (specified) number of child members for each member.
Like the DrillDownMember() function, both DrilldownMemberTop() and DrilldownMemberBottom() can be used in conjunction with tuples within the sets, as well as members. DrilldownMemberTop() and DrilldownMemberBottom() also make provision for allowing repeated comparison passes within their operation, just as we saw with the DrillDownMember() function, through the provision of an optional RECURSIVE keyword.
In a manner similar to DrillDownMember(), among numerous other functions that we have examined in the MDX Essentials series, DrilldownMemberTop() and DrilldownMemberBottom() can each be useful in a host of different reporting and analysis applications. Like other "navigational" functions of their feather (virtually all of which we examine in other articles of this and other series') each of these two drilldown functions 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.
The DrilldownMemberTop() and DrilldownMemberBottom() functions 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 functions, commenting upon the operation of each and touching upon examples of effects that we can employ each to deliver. As a part of our discussion, we will: