Groups | Blog | Home
all groups > sql server reporting services > september 2005 >

sql server reporting services : Percent on a Matrix


anthonysjo
9/27/2005 7:09:02 AM
Well, I finally got my first percentage on a Pie chart but when I went to use
the same technique on a Matrix report with the Pie being created for each new
row (Vice_President) then I started getting funny numbers. I think I have
figured out that I need to use the IN SCOPE function but I am a little unsure
how to write it.....
Do I add it to the front of the first statement I wrote?
Should I use an IIF?

I am trying to get the percent calculation off a field called Reg_Hours
(Data) and the grouping is done on a field called Vice_President (Rows).
Project_Category (Columns) is the field displayed across the top. The
dataset is called VP_Proj_Cat.

This is what I have built thus far and I know my "True" statement is not
working because it is returning the "False" portion.......

=iif(InScope("Vice_President"), Sum(Fields!Reg_Hours.Value)/
Sum(Fields!Reg_Hours.Value, "VP_Proj_Cat"), (Fields!Reg_Hours.Value))
Robert Bruckner [MSFT]
9/27/2005 12:44:30 PM
The scope defines how many rows are taken into account by the aggregate
function. If the scope name is the dataset, then all rows of the dataset
will be used.
Inside a matrix, you usually would have matrix row and column groupings.
These groupings represent scopes. For your case, it sounds like you want use
the name of the matrix row grouping instead of the dataset name to determine
percentages:
Sum(Fields!Reg_Hours.Value) / Sum(Fields!Reg_Hours.Value,
"MatrixRowGroupName")

-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.


[quoted text, click to view]

anthonysjo
9/27/2005 2:43:06 PM
I tried this FX:
=Sum(Fields!Reg_Hours.Value)/Sum(Fields!Reg_Hours.Value, "Vice_President")

Get this error:

The expression for the chart ‘chart2’ has a scope parameter that is not
valid for an aggregate function. The scope parameter must be set to a string
constant that is equal to either the name of a containing group, the name of
a containing data region, or the name of a data set.
Build complete -- 1 errors, 0 warnings

Maybe I should have mentioned that the chart is embedded in the matrix.

This is what I have defined for the matrix:
Rows: Pie Chart (New Pie for each row)
Data: Reg_Hours (Sum of hours for each pie spread across the Proj_Cat columns)
Columns: Proj_Cat (Dynamic list of columns that contain the hours for each
category)

In the pie chart I have the following:
Series Fields: Proj_Cat
Data Fields: Reg_Hours
Category Field: Nothing

You have been a big help thus far.....hopefully I have given you enough
information.
[quoted text, click to view]
Robert Bruckner [MSFT]
9/29/2005 9:31:42 PM
Assuming the reportitem name of your pie chart inside the matrix is
"Chart1", please try the following expression for the datapoint labels:
=Fields!Reg_Hours.Value / Sum(Fields!Reg_Hours.Value, "Chart1")

-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.

[quoted text, click to view]

anthonysjo
9/30/2005 6:45:01 AM
The item name for this chart is "Chart2" If I put this in and run it I still
get the same error.

The expression for the chart ‘chart2’ has a scope parameter that is not
valid for an aggregate function. The scope parameter must be set to a string
constant that is equal to either the name of a containing group, the name of
a containing data region, or the name of a data set.
Build complete -- 1 errors, 0 warnings

Any additional thoughts on what is wrong?

[quoted text, click to view]
anthonysjo
10/5/2005 9:16:03 AM
You had the formula right....I jsut missed the caps on chart1 which is case
sensitive

This worked:
=Fields!Reg_Hours.Value / Sum(Fields!Reg_Hours.Value, "chart1")

Thanks for all the help!!!

[quoted text, click to view]
AddThis Social Bookmark Button