MSSQL Server Reporting Services : Black Belt Components: Manage Nulls in OLAP Reports
November 17, 2004
About the Series ...
This article is a member of the series MSSQL Server 2000 Reporting Services. The series is designed to introduce MSSQL Server 2000 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.
Basic assumptions underlying the series are that you have correctly installed Reporting Services, 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.
This article also relies upon MSSQL Server Analysis Services ("MSAS") for a sample cube that will be used as a data source by the report with which we work in our practice exercise. For information surrounding the installation of MSAS and the sample OLAP databases and cubes that accompany the typical installation of MSAS, see the associated Books Online.
About the BlackBelt Articles ...
One of the greatest challenges in writing tutorial / procedural articles is creating each article to be a freestanding document that is complete unto itself. This is important, because it means that readers can complete the lesson without reference to previous articles or access to objects created elsewhere. A casual visitor to any article within a given series, who has presumably found it via a search, should have no more difficulty completing the article (and meeting immediate needs) than a visitor who is completing the articles in sequence, to learn the concepts presented in an ongoing manner. To meet the needs of both types of readers, while keeping articles concise and yet complete, becomes particularly challenging when we set as an objective the coverage of a specific technique that surrounds one or more components of a report, a given administrative function surrounding all reports, and other scenarios where the focus of the session is not the creation of reports, per se, but where a report or reports has to be in place before we can begin to cover the material with which the article concerns itself.
Many other factors add even more preparatory baggage, including the need in a given lesson to have a particular condition (such as null fields in a data source, for example) for which we set about providing a remedy, or providing a means of exploit. When we combine the overhead involved in just "setting the scene," the focus of the article is drowned in myriad steps simply to get to a reasonable starting point.
The BlackBelt articles represent an attempt to circumvent this. We will attempt to use existing report samples or other "prefabricated" objects that either come along as part of the installation of the applications involved, or that are readily accessible to virtually any organization that has installed the application. While we will often have to make modifications to the sample involved (we will actually create a copy, to allow the original sample to remain intact), to tune it to provide the backdrop we need to proceed with the object or procedure upon which we wish to concentrate, we will still save a great deal of time and distraction in getting to our objective. In some cases, we will still have to start from scratch with preparation, but my intention with the BlackBelt articles will be to avoid this, if at all possible.
As we discuss in my article MDX Essentials: Logical Functions: The IsEmpty() Function in working with multidimensional data sets, we are often confronted with empty cells - data is often sparse in these sets by their very physical nature. Because, as a simple example, every product might not be sold at every store in every time period (to cite an instance from the dimensions of the FoodMart2000 sample environment), we will see empty cells in abundance in a data set that contains intersects of these dimensions. (Particularly in working with crossjoins of any magnitude, we will encounter many empty cells, as a general rule.) Empty cells mean nulls, and nulls can mean incorrect results in using MDX to support analysis in reporting.
Issues that range between failure of the report to execute and mere inconveniences (such as inordinate white space, bizarre characters, and other formatting gaffes) can be the consequence of entraining these nulls into a reporting application. Reporting Services is no exception, and sooner or later, most report authors are going to find themselves facing a need to manage null fields. While one of the many beauties of the MSAS / MSSQL Server / Reporting Services combination is the fact that this is easily done within more than one layer (for instance, within the OLTP database, OLAP cube, or the report itself), we may find ourselves working with a combination or environment where we do not have all of these options.
It is the type of scenario where we have to manage the nulls within Reporting Services, for a report whose data source is an OLAP cube, which this article addresses. Management of nulls in reports based upon relational sources can be accomplished in similar ways. (My tendency to focus on OLAP reporting is based upon the fact that references abound that teach reporting for relational sources in Reporting Services, but virtually no references to OLAP reporting exist in any of the new books that have recently appeared; articles on the subject are also universally, well, sparse.) In this session, we will: