DCSIMG
Recursive Sum in a Matrix in SSRS 2008 - Ella Maschiach's BI Blog

Ella Maschiach's BI Blog

BI, Olap Technologies, Tools, System Analysis and Design

News

About Ella Maschiach

Business Inteligence

Recursive Sum in a Matrix in SSRS 2008

I read a few months back a post by Robert Bruckner saying that the InScope function isn't relevant anymore, when you’re creating a report with Tablix.

I remembered that when I wrote about a recursive sum for a group in a matrix in SSRS my example was only about SSRS 2005, as my VPC with SSRS 2008 crashed… well I finally downloaded SSRS 2008 R2 and installed it. So what did I do (after checking out the new maps feature)? Well, I wanted to see how simple creating a recursive sum in a matrix had actually become. I created a report in Report Builder 3.0, using again the Adventure Works 2005 Sample DB. I used the Employee Full Name against the Product's Product Line and the Sales Amount. I set up the recursive part by defining the row group on the FullName row group which groups on the EmployeeKey:

 

 

 

and the parent group (ParentEmployeeKey) to that on the advanced tab:

 

 

 

And that was actually it!I didn't bother creating a subtotal anymore. Just the totals for each attribute (be it the Product Line or the Full Name of the Employee). Didn't need to define InScope as an expression for the sum. Nothing! Creating a recursive sum in a matrix in SSRS 2008 is as simple as creating it in a table. I have to admit I was amazed.

So first of all I have to take my hat off to everybody at the SSRS team who are making the creation of reports more and more like child's play. You're getting the same report you got with SSRS 2005, with less trouble. That also means that your subtotals are again just for the employee inside the matrix, (and not for the employee and the workers who work under him in his team – see Abbas Syed again as an example).

 

 

 

 

That problem has not been solved, but creating the report in general has become simpler. If you still need it, InScope still exists in the function list:

 

 

So if you're trying to create a recursive sum in Reporting Services 2008, you may have discovered this – InScope is dead, long live SSRS 2008!

Comments

Ricardo said:

Hello Ella, just wondering, how would you do this in a table instead of a matrix? I can't add a total because of some scope issues. I'm using a parent-child hierarchy where I use the unique name and parentuniquename properties to make the recursive relationship.

# February 4, 2010 2:45 AM

Ella Maschiach said:

Hi Ricardo,

Before I begin, I have to say a few things:
I haven’t got SSRS 2008. My VPC crashed again on my laptop and I haven’t worked with it since… :(
My report in the blog is against relational DB and not a cube, so just make the needed adjustments of putting in uniquename and parentuniquename as you should.

Looking at this post (blogs.microsoft.co.il/.../recursive-sum-in-a-matrix-in-ssrs-2008.aspx)

And at the webcast I created way back when for creating a basic report in tablix:

blogs.microsoft.co.il/.../webcast-first-steps-in-reporting-services-2008-en.aspx

From what I remember, and what I have in SSRS 2005, this is what I would suggest:
I put the account on the details row and edit it as I would for employee in the first post. I would then click the little arrow on the Row: Details Group and choose to add a Parent Group to it. I would put Cost Center after that. I would add that to the tablix and give it a total after. The scope of the sum for cost center should be automatic in SSRS 2008.

Hope that helped,

Ella

# February 4, 2010 2:40 PM

Recursive Sum in a Matrix in SSRS 2008 « A Blog for SQL Server Reporting Services (SSRS) Programmers said:

Pingback from  Recursive Sum in a Matrix in SSRS 2008 « A Blog for SQL Server Reporting Services (SSRS) Programmers

# June 17, 2010 6:46 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: