SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL Report with multiple matrix


SQL Report with multiple matrix

Author
Message
dpelan
dpelan
SSC Rookie
SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)

Group: General Forum Members
Points: 49 Visits: 70
I have a matrix reporting data by week by location. The matrix works great for this. The challenge, however, is I want to take my total from the matrix and provide a 3 month average - easy enough to do with another matrix. Then i need to take the last weeks data (matrix 1) compare it to the 3 month average (matrix 2) and calculate a variance. Then show the max value from the 3 months and calculate a variance against the last weeks data.

for example

location A location B location C
Week 1 100 300 350
Week 2 550 350 700
Week 3 250 550 450
Total 900 1200 1500

Weekly Avg 300 400 500
Last Week Var -50 150 200
Max 550 550 700
Variance -54% 0% -35%

Any suggestions on how to accomplish the bottom calculations when you can't use fields from various matrices in a report?

Thanks in advance.
davoscollective
davoscollective
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1661 Visits: 1008
Name the cells so they are easy to remember e.g. MonthTotal and then refer to those cells directly in an expression:

=ReportItems!MonthTotal.value


dpelan
dpelan
SSC Rookie
SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)

Group: General Forum Members
Points: 49 Visits: 70
I have tried that but a matrix doesn't allow it. I get the following error message - "Report item expressions can only refer to to other report items within the same grouping scope or a containing grouping scope."
davoscollective
davoscollective
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1661 Visits: 1008
You can use multiple groups in the same tablix that aren't nested within each other. That way your 3 month average doesn't need to be in a second tablix.

You can also add totals or variances in cells that are outside any grouping at all yet still within the same tablix.
dpelan
dpelan
SSC Rookie
SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)

Group: General Forum Members
Points: 49 Visits: 70
Excuse my ignorance, but does this work in SQL 2005? If so how do i add another line in my matrix below the total line to to the calcualtions.

Thanks in advance.
davoscollective
davoscollective
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1661 Visits: 1008
My apologies I didn't see that it was for BIDS 2005. I've logged on to one of my old SQL Server 2005 machines and luckily it had BIDS 2005 installed on it so I could try.

Wow I forget how painfully bad that version was. The jump to 2008 is light years ahead. I can't work out how to do what I was suggesting in 2005, I'm sorry.

You may have to do something in the SQL to make it work, like make use of pivot/unpivot and cube/rollup.
dpelan
dpelan
SSC Rookie
SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)

Group: General Forum Members
Points: 49 Visits: 70
Thanks for checking. I ended up creating a summary table in sql and will populate summary data there for calculations and then report.

I appreciate the time and effort.
davoscollective
davoscollective
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1661 Visits: 1008
I think that you've done it the best way possible with 2005.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search