Show Total In SSRS Chart - reporting-services

I am creating a line chart from an Analysis Services cube, with a date category, a count data field, and a status series. Here's a screenshot to explain:
picasaweb.google.com/lh/photo/fP16V4sB18O1xSTrdDV-_A?authkey=Gv1sRgCLHRmcjwtI2mzAE
I want to add the blue total line, which sums all the statuses together.
I don't want to add a "Total" member to the Status dimension, because that wouldn't make sense. I've tried adding another data field and scoping it to sum everything, but I can't figure out how to make the series field only apply to a single data field—so this ends up duplicating all the statuses and getting 8 lines instead of 5.
This should be possible... I don't want to resort to writing SQL against the underlying database.

Alright so I figured out a reasonable solution in MDX. I think it would be better solved in SSRS, but I haven't figured that out yet.
The trick is to add the [Total] member to the result set, instead of adding it to the actual Dimension. Simplified MDX is here:
WITH
MEMBER [Execution Status].[Execution Status].[Total] AS
AGGREGATE([Execution Status].[Execution Status].[Pass].Siblings)
SELECT
{[Measures].[Count]} ON COLUMNS,
{[Execution Status].[Execution Status].Children,
[Execution Status].[Execution Status].[Total] } ON ROWS
FROM [CUBE]
This defines an additional member for Total which aggregates all the Statuses. Then all the Status members as well as the Total are returned. SSRS doesn't care--it still groups by the new set.
I did have some issues with getting the Aggregation to work, which is why I'm using [Pass].Siblings. [Execution Status].Children always returned (null), and [Execution Status].[All] returned 2x the correct answer, presumably because of the [All] member. I could manually enumerate all the statuses as well. Still not sure what the issue there is...

Related

Using Switch Function or nested iif in an Access Query

I have a small little Access program that sums hours of employees, with queries for Daily, Weekly, Monthly, and from the start of the year, all accessed from an easy to read form.
I have been asked to make an option group to filter employees by fulltime, seasonal, or both. But an issue I have is that I can only access the PAYRULENAME from the table which begins 'FT' for Fulltime such as FTADBRK1 but Seasonal can be a whole mishmash of possibilities, just not beginning with "FT". Still, I did not think this to be an issue.
Since I already have the original queries done, I thought I could simply add an additional column and constraint for each query instead of making additional queries. So I tried some various methods. Such as:
Switch([Forms]![MyForm]![EmpType].Value="FT",Left([PAYRULENAME],2)="FT",[Forms]![MyForm]![EmpType].Value="S",Left([PAYRULENAME],2)<>"FT"[Forms]![MyForm]![EmpType].Value="All",[PAYRULENAME])
Where EmpType is a textbox that programmatically gives a value for the option group instead of 1,2, or 3. This works and I don't think this is where the issue is.
But using the above switch function gives a -1 for Fulltime or a 0 for Seasonal (S) and doesn't filter the query. (The last option is fine - but it would be nice to give an FT or S in a column instead of the entire PAYRULENAME).
I have also tried nested iif statements to no avail. Here is one: IIF([Forms]![MyForm]![EmpType].Value="All",[PAYRULENAME],IIF([Forms]![MyForm]![EmpType].Value="FT",Left([PAYRULENAME],2)="FT",Left([PAYRULENAME],2)<>"FT"))
Any suggestions would be appreciated!

Report builder 3.0 Using Reportitems!TexboxXX.Value sometimes creates multiple boxes. Why?

I have 6 Datasets each one is the same query but has a different WHERE clause based on employee type. They generate 6 tables. At the top of the report there is a summary table which uses reportitems!textboxXX.value to grab the totals for 2 particular fields from all the tables. I'm also using a StartDate and EndDate parameter. Each reportitems! expression in the table comes from a different dataset in the report if that is relevant.
When I run the report using dates from yesterday back to the 9th of May I get the desired output.
But when I go to the 8th I get multiple rows all the same.
and as I go even further back I get even more rows of the same information. To my knowledge nothing interesting or different happened on the 8th of May and the tables further down the report look exactly the same. Any idea what might be causing this? The design view looks like this if that helps. There's no grouping or filters on the table.
Still not certain about the mechanics behind this but I found a 'solution' so I figured I'd post it. I just made a new dataset for my summary tables where the query was simply SELECT 1. Now I get a single row every time.

SSRS Report - Subgroup Totals

I have an SSRS report that is currently pulling a single dataset. This dataset contains records of inventory we have. Each record is a separate asset.
I want my report to group by a certain field, and then subgroup by certain criteria that are determined with a couple different fields. Basically there is one parent group, and three adjacent subgroups. My grouping functionality is working correctly, however I am finding it difficult to add totals to each of the adjacent subgroups. When I add a total, it is totaling the specific field within the scope of the entire dataset, instead of limiting the total to just that subgroup.
How can I add totals per field within subgroup?
EDIT: Added sample data and explanation:
You can ignore the function code field, that is what I am using to group on the parent group.
asset number,description,first year,acquisition cost,function code
190,random asset,2008,5000,100
193,random asset45,2008,56000,100
197,random asset26,2014,3000,100
191,random asset27,2014,7000,100
192,random asset36,2013,15000,100
I can't seem to attach screenshots, so here goes..
In the report you can see three subgroups; Assets, AssetAdditions, AssetDeletions. In the tablix, you can see where these groups are positioned. You can also see a row directly beneath the group that is supposed to total the subgroup at the end. However, for some reason the scope is only taking into account the entire dataset. I have tried to modify the expression in the Sum function [Sum(acq_cost), "Assets"], adding in the scope parameter but then it does not allow me to even run the report. It yells at me saying that "Assets" is an invalid scope.
The easiest way I have done this in 2012 VS is to have it return as part of the data set and have it sum up the value.
For instance if you have a quantity for inventory, and you have a subset where you only want the total quantity for that set, you add another column to your dataset called TotalSetQuantity and the subtotal field will have the expression =SUM(Fields!TotalSetQuantity.Value) rather than =SUM(Fields!Quantity.Value).
You can try iif statements within your report like =sum(iif(Fields!ColA.Value=1,Fields!Quantity.Value,0) but I had some troubles getting that to work.
Hope that helps, I ran into this issue this past week and the first option worked like a charm for me.

Can't figure how to use lookup() in SSRS 2008 R2

In the report I am building I have 2 data sets: one gives me, per user, per day, the total amount in that status; the other one gives me, per user, how many days in the date range the user actually showed up at work. Each of these data sets comes from its respective stored procedure. See screenshot.
The problem I have is that I need to report not the total time in status per user, but the average per day. So in the screenshot you can see that one user has 5 entries for 5 days worked and the other one has 3 entries for 4 days worked. simply because in one of those 4 days he didn't had that status at all.
I tried adding a calculated field to my "status" data set by using the lookup() function but it kept on giving me errors, which makes me think I don't quite know how to use it.
I also tried using group variables, and I was able to define it under group properties, but it never come up as an option to be used when writing an expression.
Any ideas using lookup(), variables or otherwise?
You're on the right track. Sounds like the Lookup function is exactly what you want.
Instead of trying to add the calculated field to the dataset, try putting it directly in the report item where you want this displayed.
Something along these lines should work:
=SUM(Fields!Available.Value)
/ Lookup(Fields!UserId.Value, Fields!UserId.Value, Fields!Days.Value , "NameOfDaysDataset")
If this isn't working, please post a few more details of your data sets, field names, and where you need this to appear.

SQL Server Report Builder - Show Count of Sub Groups

I have a SQL Server Reporting Services report that shows customer order data, but it's grouped as follows:
Store
Customer
Customer Order Items
So, each report is a grouping of stores, with a subgroup of customers per store, and then the items per customer. I'm trying to show aggregate sale and other information at each header record of the appropriate group in the report. Most of this is working well, but for each store header record, I want to show a count of the customers. I'm trying to use some variation and\or combination of RowCount, CountDistinct and other aggregate functions, but to no avail.
Can anyone help me determine how I essentially can get a "count" of customer groups to show at the Store level header? TIA!
CountDistinct on Customer should work fine - no need to specify scope if it's in the Store group header row.
I put a simple test together.
Data:
Report in designer:
Most important thing to note is the CountDistinct on Customer in the Store header row; this is just the expression used:
=CountDistinct(Fields!customer.Value)
End result, showing correct values:
Please let me know if I'm missing something.
Edit after comment:
Apologies in advance for how long this is getting.
The previous report did have row groups for Store and Customer, but I've modified this to make it more clear, hopefully. Still based on the same DataSet:
You can see there are three row groups, and each row in the report is actually a group header row belonging to one of those groups.
In the Store group header row I've kept that same CountDistinct expression. I've also added a CountRows() expression to show how many actual rows are available in each of the different groups.
Here you can see for Store1, CountRows is returning 4, i.e. there are four rows that we are aggregating in this scope, which is what we expect looking at the DataSet.
Similarly, when we apply =CountDistinct(Fields!customer.Value) in the Store scope we are considering these same 4 rows, and we see two distinct customers for Store1, which seems correct to me.
For Store2 we are considering 6 rows in total, which have three distinct customers. Again, just by applying =CountDistinct(Fields!customer.Value) we get correct value.
Hopefully this rejigged report helps clear things up. If I'm still not getting your requirements, can you please explain what numbers are wrong in my sample report based on my sample DataSet? That way I can adjust things easily on my side.