Using RUnning Value to create a pareto in SSRS - ssrs-2008

I am trying to create a Pareto chart for the table below
Press
Reason
Qty
A
Broke
5
B
Broke
10
C
Broke
15
D
Broke
5
E
Broke
10
F
Broke
100
I am trying to create a pareto using the following:
=RunningValue(Fields!LossQty.Value/Sum(Fields!LossQty.Value, "Conf_Scrap")*100,Sum, Nothing)
But I keep getting the error:
"The Y expression for the chart has a nested aggregate that specifies a dataset scope. Inner aggregates cannot specify a dataset scope. "
I am at a loss on how to get the pareto to work

If the sample is really your dataset results then I'm not sure you need to specify the scope at all.
Try removing the , "Conf_Scrap" from your expression.
If this does not work, your report design including any groups defined in the report and a larger sample if data (if applicable)

Related

Parallel job is adding extra columns when outputting to a dataset

The last job before my dataset is written is a transformation. It's a lot more complex than this, but the basics are:
input = A Integer, B Integer and C Integer
output = A Integer, if B > 10 then C else 0 -> C Integer
So, to clarify, column A is just passed through and columns B and C are used to perform a transformation that is called "C" in the final output link.
When I examine the columns being written to the dataset I see A and C. I can save the table definition and this is also just columns A and C. However, when I actually run the job, column B also ends up in the dataset, so I end up with (in any order) columns A, B and C.
I've tried deleting my output dataset, then recreating it, giving it a new name, but it always ends up with that "working column" B in it for some reason I don't fully understand. I don't see how it's picking up a column that isn't in the final output link and choosing to add it against my wishes.
I don't want column B in my dataset, it's wasteful to store it and it's confusing for developers as it shouldn't be there in the first place. How do I stop DataStage from writing it?
Seems you have RCP Runtime Column Propagation activated - that will transfor all columns available independend of the specified ones.
Go to the stage (Transformer) - Properties - Output tab and there is a checkbox Runtime Column Propagation - remove the check mark.
In other stages it could be located on the columns tab as well.
In the job properties of your job there is also a setting which will enable RCP for new links - remove this mark as well to avaoid this problems for future job extensions.
For more details on RCP check out this.

COUNTIF based on three conditions using OFFSET and MATCH

Please see example screengrab
I would like to populate cell M2. Firstly to match K2 (Taylor) against column headers C1:I1 looking at the results in the column C2:C32. I would like to find the amount of times "a" appears in C2:C32 where Type (Column B) = "r".
So the result would be 3 (Reynolds, Maggio & Hamilton).
As you can see I've managed to populate Column R with totals without comparing against Type (Column B) but am having great difficulty understanding how to extend the comparison, intentionally without the use of helper columns/rows.
Any help would be greatly appreciated.
Since you have to depend on 2 columns, you will have to use COUNTIFS. Without being dynamic, the formula for M2 would be:
=COUNTIFS($B$2:$B$32,"r",$C$2:$C$32,"a")
^------------^ ^------------^
1st Condition 2nd Condition
To make it dynamic, only the second column needs to be changed:
=COUNTIFS($B$2:$B$32,"r",OFFSET($B$2:$B$32,0,MATCH($K2,$C$1:$I$1,0)),"a")
Your total's formula could be simplified to this also (keep the range as it is instead of manually putting it as 32 rows high for instance):
=COUNTA(OFFSET($B$2:$B$32,0,MATCH($K2,$C$1:$I$1,0)))

Zscore with Rolling Window Panel Data

I am trying to calculate the zscore with Rolling window. I need to actually calculate standard deviation for a 3 year rolling window to calculate z-score. A minimal working example is given below:
use http://dss.princeton.edu/training/Panel101.dta
xtset country year
rolling sd_x1=r(sd), step(1) window(3) saving(sd_x1, replace) keep(year): sum x1, detail
Now after this I need to merge it back with the original file. But the variable year does not appear but a column name date appears with all missing values. I am trying to merge it using the following command:
merge 1:1 country year using sd_x1
However, I get the error that variable year is not found and actually this variable is not kept while running the rolling command. Any help will be much appreciated.
I am always surprised that people have interest or faith in standard deviations based on three values.
A more direct approach would be to use rangestat (SSC). The syntax could be something like
use http://dss.princeton.edu/training/Panel101.dta
xtset country year
rangestat (sd) sd=x1, interval(year 0 2) by(country)
except that I cannot test this at the moment.
The key difference here is that rangestat produces new variables in the current dataset. Search the Statalist archives for examples of rangestat use.
Note that in your example the detail option is unnecessary as summarize by itself produces standard deviations.
You can extend this approach to get the mean at the same time.

SSRS Math Ops Report Body..Aggregat functions can only

I'm really struggling to find out the proper approach to adding (or other math operations) in the report body. Surely this is a daily operation done by report writers all over the world but I'm missing the boat.
I can add etc. fields from a dataset such as SUM(Fields!FieldA + Fields!FieldB).
However when I try to work with two textboxes in the report I get the Aggregate functions can be used only on report items....blah. For example SUM(ReportItems!Textbox1 + ReportItems!TextBox2).
So how does one add two textbox values on the report body????
JB
You should be able to use =ReportItems!Textbox1.Value + ReportItems!Textbox1.Value without the Sum, assuming you're just adding values that have already been aggregated in the original textboxes.
It's hard to say without being able to see where the textboxes are in the report and what underlying values they're displaying.
You can also consider using the exact same underlying functions in the source textboxes, e.g. if textbox1 is the total of value1 in DataSet1 and textbox2 is the total of value2 in DataSet2, you could use something like:
=Sum(Fields!value1.Value, "DataSet1") + Sum(Fields!value2.Value, "DataSet2")

Aggregate not populating chart correctly in SSRS

Below, I've attached a sample of my data as well as a sample of the chart output. I want to aggregate the data and include one row with this number; however, SSRS is just showing multiple of the same value.
In the example below, you'll notice there are 8 rows in Unit 1 and 8 rows in Unit 2, a
total of 13. How can I get Unit 1 to have one row which shows 8 and one row in Unit 2 to show 5? Currently, the expression is =COUNT(Fields!SubID.Value, "DataSet1").
I've also tried adding in a column full of the number 1 which I could use to Sum on, but that produced the same results.
Originally I was doing this all in SQL; that is, producing the exact output I want in SQL and then charting in SSRS. However, this is no longer a viable solution as the end user would like to be able to drill down into the details of the report. I do imagine, if there is no easy way to do this (which I feel like there has to be), that I could write two queries, having one show the report and the other show the details.
Thanks.
The second parameter of your count expression is the problem.
Don't use this:
=COUNT(Fields!SubID.Value, "DataSet1")
Try something like this instead:
=COUNT(Fields!SubID.Value, "UnitGroupName")
The group name should match what is shown in BIDS as the name you've given the grouping, such as under Row Groups.