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
Related
I have a data source with data formatted like this:
ID
Visits
Charges
Date
Location
33
21
375
2022-01-29
A
34
4285
4400
2022-01-29
B
35
12
2165
2022-01-29
C
36
31
4285
2022-01-30
A
37
40
5881
2022-01-31
A
38
29
4715
2022-01-31
B
39
8
1390
2022-01-31
C
I want to get the aggregated visits of all locations per day, and from there getting the Max value of a day for the time period chosen by the user on a ScoreCard and a Table. At the moment when i choose the max value of the metric visits it only gives me the max value of column (4285), not for the aggregated data per day.
The value i am looking for, in the time period between 28-01 and 31-01 should be 4318 (the sum of all 3 locations for the 29-01, which is the highest of the 3 days)
Thanks!
What I may suggest is to use Pivot Table like this:
You choose Date as your row dimension. Then you choose Visits as metric (aggregation set as SUM).
Remember to sort this table by Visits in descending order. Your maximum value should be on top. If you want to see only this maximum value, you can change size of your pivot table to keep only first value visible.
This should work with additional controls too.
I have an old cube built in SSAS. We break revenue down into a time dimension like so:
fiscal week
Date
Revenue
Prior Year Revenue
53
2020-12-31
$5000
????
49
2020-12-03
$1000
$200 (should be $100)
50
2020-12-10
$2000
$300
51
2020-12-17
$3000
$400
52
2020-12-24
$4000
$500
As you can see, the 53rd fiscal week is not displaying in the proper sort order.
This is becoming a problem due for a dimension we use, "Prior Year, Week". This attempts to grab the revenue from the same fiscal week instead of the previous year. It accomplishes this by calling ParallelPeriod([FiscalWeek], 52), [Measures].[Revenue]).
What I believe is happening is that because week 53 is at the beginning of the month, ParallelPeriod is counting it as one of the intervals it skips. This results in the Prior Year column showing fiscal week 50 when it should be 51, 51 when it should be 52, etc.
Is there a way to sort those dates? I've tried the obvious KeyColumnstuff and examined the source views, and nothing seems like it should be causing this poor sort.
Thanks in advance -- I don't know much about this stuff and am sort of being tossed into the deep end here.
EDIT:
I've made some progress here but still having issues. It appears that every year with 53 fiscal weeks would have this problem -- week 53 is sorted improperly.
The time dimension breaks down like this:
Year
Quarter
Month
Week Number
Bill Date
The bill dates are sorted in order, but for some reason, the weeks in the Browser look like this:
53
1
2
3
...
It appears that the Week Number attribute is the one that's off. The OrderBy property is set to AttributeKey and the OrderByAttribute property is set to Bill Date attribute. However, viewing just the pubdates reveals that they are properly sorted.
EDIT:
After setting the OrderBy to Key as suggested by the response below, it appears that some of the month hierarchies are out of order. For instance, certain months are containing weeks that don't belong. For example:
* Sep
* 35
* 2020-08-27
* 36
* 2020-09-03
* 37
* 2020-09-10
* 38
* 2020-09-17
* 39
* 2020-09-24
Here's the XML for the month attribute:
<Attribute>
<ID>Month attribute</ID>
<Name>Month attribute</Name>
<Type>Months</Type>
<EstimatedCount>48</EstimatedCount>
<KeyColumns>
<KeyColumn>
<DataType>WChar</DataType>
<Source xsi:type="ColumnBinding">
<TableID>dbo_dim_time</TableID>
<ColumnID>fiscalmonth</ColumnID>
</Source>
</KeyColumn>
</KeyColumns>
<NameColumn>
<DataType>WChar</DataType>
<Source xsi:type="ColumnBinding">
<TableID>dbo_dim_time</TableID>
<ColumnID>fiscalmonth</ColumnID>
</Source>
</NameColumn>
<AttributeRelationships>
<AttributeRelationship>
<AttributeID>Pubdate attribute</AttributeID>
<Name>Pubdate attribute</Name>
</AttributeRelationship>
</AttributeRelationships>
<OrderBy>AttributeKey</OrderBy>
<OrderByAttributeID>Pubdate attribute</OrderByAttributeID>
<MembersWithData>NonLeafDataHidden</MembersWithData>
<MembersWithDataCaption>(* data)</MembersWithDataCaption>
<AttributeHierarchyVisible>false</AttributeHierarchyVisible>
</Attribute>
The OrderBy design you described referencing Bill Date seems overly complex for your requirements.
For the Week Number attribute, I would just set the OrderBy property to Key.
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)
)
I have a Reporting Services report which shows a bunch of KPI scores. Each KPI has it's own Row on the report and for each row we show the SUM or AVG (depending on KPI type) score for last 3 years, and then a SUM, AVG or (ideally) total YTD figure per month in the current year:
KPI 2009 2010 2011 Jan Feb Mar Apr May etc.
Bagels Eaten (Total) 100 90 70 10 20 9 13 14
Sandwiches (Cumm. YTD) 90 75 86 13 23 46 65 76
The problem I'm seeing is that the RunningValue function appears to be working across rows, instead of within the filtered column group and current row that makes up the Jan, Feb, Mar columns (monthly data, grouped by year and month, filtered on current year). So the output is not as above, instead its a fairly random figure based on all the values in the rows (I'm sure it's not random it just looks like it is).
The Column Group is called "MonthNum" and the Expression for the cell value decides which aggregation to apply based on an "AggregationType" value in the source data:
=Switch(Fields!AggregationType.Value="SUM", Sum(Fields!ScoreValue.Value),
Fields!AggregationType.Value="AVG", Avg(Fields!ScoreValue.Value),
Fields!AggregationType.Value="YTD",
RunningValue(Fields!ScoreValue.Value,Sum,"MonthNum"))
Any help much appreciated
Update:
Here is an example few rows (scores per month, per kpi) of the data set being used (formatting is a bit tricky!). Items with aggragation type 'YTD' would have the cummulative YTD expression applied, everything else would be SUM for the current month:
KpiID Title KPIOwner ScoreValue YearNum MonthNum ReportingGroupTitle ScoreType DisplayOrder DisplayPrecision UnitOfMeasure AggregationType
5 Donuts Served Donut Manager 35 2007 1 Catering Services Actual 10020 0 Number YTD
5 Donuts Served Donut Manager 42 2007 2 Catering Services Actual 10020 0 Number YTD
5 Donuts Served Donut Manager 86 2007 3 Catering Services Actual 10020 0 Number YTD
5 Donuts Served Donut Manager 14 2007 4 Catering Services Actual 10020 0 Number YTD
6 Donuts Cooked Donut Manager 45 2007 1 Catering Services Actual 10020 0 Number SUM
6 Donuts Cooked Donut Manager 48 2007 2 Catering Services Actual 10020 0 Number SUM
6 Donuts Cooked Donut Manager 93 2007 3 Catering Services Actual 10020 0 Number SUM
6 Donuts Cooked Donut Manager 32 2007 4 Catering Services Actual 10020 0 Number SUM
6 Donuts Cooked Donut Manager 18 2007 5 Catering Services Actual 10020 0 Number SUM
From what I understand from your question this is what I would do:
Assuming that when the aggregation type YTD returns the acumulated totals until (and including) the MonthNum.
Create a Matrix with two a groups on KpiID and a child group on AggregationType, and two column groups (adjacent) one on the year and one on the month (on the year group, create a filter so that you don't include the current year and on the month group exclude the values where the year is not the current one).
Then you can use the following expression, for both the year and the month group (the last will give you the YTD value for the last month in each year)
=Switch(Fields!AggregationType.Value="SUM", Sum(Fields!ScoreValue.Value),
Fields!AggregationType.Value="AVG", Avg(Fields!ScoreValue.Value),
Fields!AggregationType.Value="YTD", Last(Fields!ScoreValue.Value))
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