SSRS - calulcate sum of rows in a separate column - reporting-services

Is it possible using SSRS report (Tablix) to generate a report in the following format. The details need to be maintained while the total amount needs to be displayed in merged cells.
Desired Output
Current Output
To my existing report i added a group under details. What i got was that the row collapsed into a single record as below
Any help is appreciated. Thanks.

You cannot get this in the format you require.
You are grouping by TransactionID then by the separate amounts (I used a rowID for this to get a unique ID to group on), which means that at the point where you want the merged cells you are grouping by a unique transaction amount. You cannot then group back out to TransactionID.
You can swap the fields over - the total before the amount column. This will work, but likely look wrong for your requirements.
Have a read about data regions (https://technet.microsoft.com/en-us/library/ms156394(v=sql.100).aspx) and grouping (https://msdn.microsoft.com/en-us/library/dd255263.aspx) to understand more about the issue.

Related

SSRS - Merging cells of specific columns

I am developing a complex report in SSRS which should like below
Screenshot 1
output returned by stored proc have multiple rows of one User ID and based on that columns "Successful Orders -- Online - Total Orders", "Successful Orders -- Online - Total Amount" & likewise Retail - Total, Other - Total columns cells should be merged based on respective User Id.
I have used tablix control and tried adding grouping over columns which needs to be merged but it is not working as expected. in order to group I am setting Sum of returned Value in cell but yet no luck.
Can you please provide me some pointers in order to achieve whats expected. please let me know if you need more information
output after adding nested tablix
ScreenShot 2
also, distorted output with inner tablix. borders are causing issues
ScreenShot 3
Try placing a tablix in the cells containing the multiple rows to display them. Basically, you need to switch your approach from "How do I merge these cells?" to "How do I split these cells." Set up your grouping at the level you want your totals and then in each of the columns where you want the details displayed, add a tablix to display the details. You'll need to play with the grouping a bit to get it display correctly.
More details:
The sample you provided above should be one group level row, not multiple detail level rows. Add your group to that Tablix and the summaries you want for your Total columns. Then Merge each of the "Mode" and "Count" column pairs and insert a Tablix into that merged cell with the same grouping as the row with the Totals, but with only the Details row displayed (don't add group header or footer and delete the blank row and summary column that automatically gets added). Now just set your field values for Mode and Count and adjust your column widths to match the headings.
Here's a REALLY simple report that displays a Plant and the employees associated with that plant. This is the top level where you Totals group would go. The next image is the "inner" part, where you would add in another Tablix with the same group(s), but only the details displayed.
This is super simple example and you may need to include additional levels of grouping to match your report, but the fundamentals still the same - an "outer" Tablix with an "inner" Tablix with matching group(s).
There's a lot you can do with this approach by manipulating the groups, hiding/displaying different groups or even hiding the details and displaying subtotals.

Repeat entire Table data on multiple pages - SSRS

I currently building one report in which the same data has to be repeated on multiple pages.
- So, I have a field (Quantity) based on which I have to decide the times' data has to be displayed. For example, if the quantity is 5, the report has to print 5 pages with each page printing the same data. This is usually used when we print Shipment labels.
Is it possible to achive this in SSRS. Grouping would have solved my issue but since the value that I have is a scalar, I am not sure if it is possible.
Any inputs/Suggestions.
You can repeat contents on multiple pages by placing it all inside a grouped cell. See my answer here for more detailed instructions on that. For this particular case, you would want to have a column in your dataset that has the desired quantity.
One way to do this would be to cross join your query with a subquery that has your desired quantity. Then you can group by the new column and get the same data within every instance of it.

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.

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.

SSRS Subreport or other solution

I am working on a report that will show scheduling data. This report will need to show data for any job that has a promised date between a specified date range.
The issue I am running into is how to best display this data, I have a dataset built that has header info (Job #, Description, Due Date etc.) which returns a single line row for each job.
There are then several detail records for each job (Line item descriptions / details, Work center descriptions and details). Each of these could return several rows.
My question is how to group this detail data with each header record. Hoping to have something like this with one record block per job:
-- Header Dataset Job Number , Job Desc, Date Ship By ... etc.
--Line item description dataset
--Work Center dataset
Next record.....
Thanks in advance for any help.
Brian
If each of the records in your dataset have a field that they can be grouped by then this is actually pretty easy. You need to use the grouping feature of the table in SSRS. It's easiest to create a view that contains all the rows (both headers and details) logically and pass it to SSRS as one dataset.
Here is a recent walkthrough from Microsoft. You can change the version number to match your specific version since you didn't specify in the question. Group header fields can be formatted distintly to make them standout etc.
http://technet.microsoft.com/en-us/library/dd255263.aspx
If a field that you can group by isn't contained in the dataset in the report, i.e. it's a foreign relationship or something and you can't put them into a single view then you'll need to look into sub-reports. Based on the information provided however a simple row or column group should work just fine.