SSRS Group Total with multiple datasets lookups - reporting-services

I have a report with multiple datasets. I am trying to get the total of each expression for each manager. The expressions are lookups. I cannot merge the datasets into one and I cannot reduce the number of columns due to business requirements.
=Lookup(Fields!EmpId.Value, Fields!EmpId.Value, Fields!TOA.Value,"dsToa")
I have tried =Sum(Fields!Goal.Value, "dsToa") which gives the whole total but not the total per manager. When I try =Sum(Fields!Goal.Value, "ManagerName") I get an error "Report item expressions can only refer to fields within the current dataset scope or, if inside an aggregate, the specified dataset scope".
Any help is greatly appreciated!

Related

SSRS group on lookup field

I have an ssrs matrix and have a lookup to another dataset2 field (Jurisdiction)
I want to row group by this dataset2 Jurisdiction.
The problem is that the tablix will work on a non group lookup but will not allow me to group on and display the dataset jurisdiction field.
is this possible in ssrs?
Thanks
As a general rule, it's much better to join subqueries in the SQL rather than using the Lookup function. Both in terms of efficiency and also avoiding the limitation you described in the report design.
If the datasets are truly different data sources, consider using an ETL process to combine them into a single table for the report to use as its dataset.

How to fetch data in a Single SSRS report using Multiple Dataset

I was trying to create SSRS report with a country map and a table. Country Map for showing total Number of Cases state wise and a table to show the total number of Cases in the whole country on the Top Middle side of the Report. Both (Map and Table) Using Different Datasets.
When I run the report to preview the data, It gives me an error:
The Endvalue expression for the map uses an aggregate expression without a scope. A Scope is required for all the aggregates used outside of a Data region
However, I have also tried to use the first dataset to calculate the Sum of all cases in the country.
But it shows the data in the table state wise not the Complete Sum.
=Sum(Fields!Total_Cases.Value)
I have read some issue similar to this topic but unable to implement them.
For displaying total cases in the table I have also mention the dataset name but not getting result.
=(Fields!Total_Cases.Value, "Dataset2")
Please suggest the correct way..

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.

SSRS: Value not to be grouped

I have a chart that currently has a count of cases, and then grouped by users, now I am trying to implement a second value which is a round up of all users and gives a global average.
this global average for obvious reasons cant be grouped based on the users in order to give the correct representation.
I am not using VS to output these reports but I using SQL report Builder 2008 R2.
Is there anyway that I can overcome this global avg being grouped by users, can I use a filer to stop this maybe?
The global average would be the number of cases divided by the number of distinct users. You can aggregate over the entire dataset by including the dataset name:
=Sum(Fields!Cases.Value, "MyDataset") / CountDistinct(Fields!User.Value, "MyDataset")

SSRS IIF Syntax with Multiple Datasets

I have a report with 2 data sets and would like to perform a SUM operation in a textbox expression. The problem arises when I want to perform an IIF in the sum since I only want a particular category of values summed.
I would like to get a sum of all the "Good" ranking values from the dsRetrieveCustomerAssetScores dataset. Please note there is more than one data set in the report, so I need to specify the scope when using the aggregate function. Below is the code I've tried (along with other permutations).
=Sum(iif(Fields!ranking.Value,"Good",1,0), "dsRetrieveCustomerAssetScores")
Any ideas?
You may have more than one dataset in your report, but I don't think it's possible to have more than one dataset per tablix. (Subreports within the tablix may be bound to a different dataset, but anywhere within the subreport will only be accessing that other dataset.)
The scope specified within aggregation formulas is normally related to groups within the tablix, not the datasources.
So, the code:
=Sum(iif(Fields!ranking.Value,"Good",1,0))
- should work within your tablix, as long as that tablix is accessing the dsRetrieveCustomerAssetScores dataset.