In these last days I’ve been working on a BI solution for a logistic company. One report I have to create has a particular behavior that can make life a little complex if you’re using Reporting Services: the value used in rows and column totals is not calculated in any way, but is just taken from the database (SSAS in this case), just like any other cell value:

I’ve found this business case in a report that shows all the target values that a salesman has to reach. The total value for a month is not the average nor the sum of the target values for all the regions, but is just a fixed value set by someone (his manager, normally :-)) that represents that overall expected target for that month.
The data returned from the database (no matter if using MDX or SQL; in this example I’m using T-SQL but in reality I’m using MDX) look like the following:
![clip_image001[8] clip_image001[8]](http://sqlblog.com/blogs/davide_mauri/clip_image0018_51DC13F7.png)
The null values in the region column represents the “total” value for that month, while for date (which is stored in a yyyymmdd integer format), as you may guess, the values for year are represented by the rows with value “0” in the month part.
If you just use these values in a Tablix, using the
![clip_image001[10] clip_image001[10]](http://sqlblog.com/blogs/davide_mauri/clip_image00110_thumb_09FF0B7F.png)
this is what you obtain:
![clip_image001[12] clip_image001[12]](http://sqlblog.com/blogs/davide_mauri/clip_image00112_thumb_1BFB293F.png)
clearly the column “20090000” and the no-name row are in the wrong place, since they should be shown as the last and the rightmost values, just like what normally happens with totals.
How to do that? The anwser lies in the usage of Adjacent Groups and Group Filters.
The first step is to remove that row and column from the data. This can be done specifying a filter for the existing groups.
For the reference_data group you just have to say that you want to filter out all the data related to the 20090000 value:
![clip_image001[14] clip_image001[14]](http://sqlblog.com/blogs/davide_mauri/clip_image00114_thumb_23C31BE1.png)
For the region, since we’re using a null value, we have to use a little trick since the operator “is” is not available.
In the Filter Expression field we have to specify something that will turn null to True or False:
=(Fields!region.Value Is Nothing)
then in the Value field you just have to specify “True” (or False if you’re using the “=” operator):
=False
Now, the matrix won’t display the “total” row and column. To show where we want we just have to add one Adjacted Group for columns and one for rows:
![clip_image001[1] clip_image001[1]](http://sqlblog.com/blogs/davide_mauri/clip_image0011_thumb_0D40578D.png)
So that at the end the matrix will look like this:
![clip_image001[3] clip_image001[3]](http://sqlblog.com/blogs/davide_mauri/clip_image0013_thumb_2A65FF97.png)
Now, if you run the report, the result will be the one we expect:
![clip_image001[5] clip_image001[5]](http://sqlblog.com/blogs/davide_mauri/clip_image0015_thumb_406C6B29.png)