SSRS Calculating counts across row and column groups - sql-server

I'm building a report of case results with a parent-child grouping on the row group and single column grouping:
Parent Row Group: Location
Child Row Group: Result
Column Group: Month
Running across the report are months in the year, and running down the report are the location and the different result breakdowns for the location in the given month. Looks something like this:
Jan Feb Total
% # % # % #
Main Office
Pass ? 5 ? 6 55% 11
Fail ? 5 ? 4 45% 9
Total 10 10 20
Other Office
Pass ? 3 ? 2 25% 5
Fail ? 7 ? 8 75% 15
Total 10 10 20
I have everything working except for the percentage breakdowns as indicated by the question marks above. I can't seem to get that total (the 10 for each month/location set above) reflected into my expression caclulation. Any ideas on how to setup my groups and variables to properly render these percentages?
Here's my attempts so far:
Count(Fields!Result.Value, "dsResults") = 40
Count(Fields!Result.Value, "LocationRowGroup") = 20
Count(Fields!Result.Value, "ResultRowGroup") = 11 - (for the Main Office/January/Pass cell, which is the total for the whole year for that result)
Count(Fields!Result.Value, "MonthColumnGroup") = 20
SSRS gets the count correct on the total line right, so there must be a way to reproduce that scope within the data cells?

I sometimes work around annoying SSRS scope issues by pre-calculating my totals, subtotals and percentages. Take a look at this response (to a different post) for an example. I know it is unsatisfying, but it works: pre-calc values suggestion

Related

Measure for a month and its previous using a named set SSAS

I have a named set that returns the last 10 weeks from the current week. In the cube browser I get the value of a measure for each week.
I want to create another measure that contains the value of the previous week returned by the named set. Something like this :
Weeks Measure1 Measure2
Week 1 50 40
Week 2 35 50
Week 3 77 35
How to do this using MDX ?
Measure2 will be a tuple of whatever measure you want to show - lets calls it [Measures].[Revenue] and the currentmember of the hierarchy used in the Weeks column lagged by 1.
I don't know the structure of your cube so you'll need to adjust the following:
(
[Measures].[Revenue],
[Date].[Calendar Week of Year].CURRENTMEMBER.LAG(1)
)

How should i format/set up my dataset/dataframe? and factor ->numeric problems

New to R and new to this forum, tried searching, hope i dont embarass myself by failing to identify previous answers.
So i got my data, and i intend to do some kind of glmm's in the end but thats far away in the future, first im going to do some simple glm/lm's to learn what im doing
first about my data:
I have data sampled from 2 "general areas" on opposite sides of the country.
in these general areas there are roughly 50 trakts placed (in a grid, random staring point)
Trakts have been revisited each year for a duration of 4 years
A tract contains 16 sample plots, i intend to work on trakt-level so i use the means of the 16 sample plots for each trakt.
2x4x50 = 400 rows (actual number is 373 rows when i have removed trakts where not enough plots could be sampled due to terrain etc)
the data in my excel file is currently divided like this:
rows = trakts
Columns= the measured variable
i got 8-10 columns i want to use
short example how the data looks now:
V1 - predictor, 4 different columns
V2 - Response variable = proportional data, 1-4 columns depending on which hypothesis i end up testing,
the glmm in the end would look something like, (V2~V1+V1+V1,(area,year))
Area Year Trakt V1 V2
A 2015 1 25.165651 0
A 2015 2 11.16894652 0.1
A 2015 3 18.231 0.16
A 2014 1 3.1222 N/A
A 2014 2 6.1651 0.98
A 2014 3 8.651 1
A 2013 1 6.16416 0.16
B 2015 1 9.12312 0.44
B 2015 2 22.2131 0.17
B 2015 3 12.213 0.76
B 2014 1 1.123132 0.66
B 2014 2 0.000 0.44
B 2014 3 5.213265 0.33
B 2013 1 2.1236 0.268
How should i get started on this?
8 different files?
Nested by trakts ( do i start nesting now or later when i'm doing glmms?)
i load my data into r through the read.tables function
If i run: sapply(dataframe,class)
V1 and V2 are factors, everything else integer
if i run sapply(dataframe,mode)
everything is numeric
so finally to my actual problems, i have been trying to do normality tests (only trid shapiro so far) but i keep getting errors that imply my data is not numeric
also, when i run a normality test, do i only run one column and evaluate it before moving on to the next column or should i run several columns? the entire dataset?
should i in my case run independent normality tests for each of my areas and year?
hope it didnt end up to cluttered
best regards

Reference a specific field in the details section to make field on the report footer - Crystal reports

My data/table that appears in the details section is pulled from SQL.
It essentially is a basic table with Row Names in column 1 and dates going across row 1 with the final column being a summation of the data.
The data is 4 rows long and what I am looking to do is create a field that I can put in the report footer that will display the same information as any one of the individual fields that is displayed in the totaled column (last column) of the table / details section.
For example if the 3rd row totaled 12 (in the details section of the report), I would like to create a standalone field that will display the 12 in the report footer.
The details section looks like a table: the report footer breaks out certain things from the details section. I need something that will allow me to reference the individual numbers in the details for example: only pull in the 18 or only pull in the 11 into its own little field on the report footer. Thanks.
Months 1 2 3 4 total
Jack 3 3 4 5 15
Will 4 7 5 2 18
Mike 1 3 3 5 12
Don 3 5 2 1 11
You need to manipulate by storing in the array and retriving one by one.
To store in array:
Create a formula #Total
Shared Numbervar array x;
x:=x+(total);
total
In report footer write one more formula #display
Shared Numbervar array x;
x[1] // first element in the same way 2,3,4 will give you all elements
Let me know in case any issue.

How to get total of top 10 With TIES sales in SSRS

I am taking Top 10 of Sales Volume grouped by Product categories in SSRS 2012. I need the total of these top 10 but it shows the complete total.
For this I have used running value inside group and Written hidden expression below. This absolutely working for top 10 rows and rows less than 10.. In my report searching based on TaxID..So there may be chance of total sum ties..! so that case this condition is failing
Note: This is condition working for top 10 rows and also rows less than 10...but only failing rows more than 10 rows means top sales ties.( If 10th and 11th category sales are same those are pulling up into report..but sum is making problem for me)
=IIf(RunningValue(Fields!grp.Value, CountDistinct, Nothing) = 10
or (RunningValue(Fields!grp.Value, CountDistinct, Nothing) = CountDistinct(Fields!grp.Value, "DataSet1") and CountDistinct(Fields!grp.Value, "DataSet1") < 10)
, false
, true)
I can't do it on dataset level as I need the complete dataset for other parts in the report. Thanks in advance.

How to sum SSRS Matrix Columns on Row Group

I have a report that displays the total hours a person worked for each project they are assigned to, aggregated on month. I would like to sum the total hours for each person, for each month, in SSRS 2008 R2. So, for example, I have the follow data and would like to column totals like so:
January February March
Worker 1
Project1 50 80 20
Project2 30 10 60
Project3 10 40 5
Total: 90 130 80
Worker 2
Project1 20 40 60
Project2 10 30 10
Porject3 30 10 50
Total: 60 80 120
Everything I have tried so far either sums each column for all workers combined (summing by 'Month' column group) or sums all hours for each worker (Summing by 'Person' row group).
For completeness, my row groups are:
Person
Project
RowGroup
My Column groups are:
Month
ColumnGroup
I know that I can create another query/data set to do this, but I was hoping that SSRS can do this fairly easily. It seems like a trivial problem and perhaps I am just missing something.
Any help would be great or perhaps this is something that SSRS can't do.
If you are trying to add a Column containing totals, it is pretty simple just
right click on cell --> Totals --> Column
As shown here

Resources