Lookup function error in SSRS 2014 - reporting-services

When i am creating SSRS report getting error like" the value expression for the text box "" has a scope parameter that is not valid a lookup function."

It seems that you have a LOOKUP function in an expression that is using an incorrect value for the dataset score.
In this example, Product" is the scope.
=Lookup(Fields!SaleProdId.Value, Fields!ProductID.Value, Fields!Name.Value, "Product")
Since it doesn't give the text box name, the expression with the Lookup must be in some other object.

Related

Error when trying to use Where clause in SSRS expression

This SO link, WHERE Caluse in SSRS expression, verifies that my syntax is correct yet I get this error:
"An error occurred during local report processing.
The definition of the report is invalid.
The Value expression for the text box 'txt1A_EMA' uses an aggregate expression without a scope. A scope is required for all aggregates used outside of a data region unless the report contains exactly one dataset."
My expression:
=Sum(IIF((Fields!COU_EMA.Value, "CA_Summary") = 1, (Fields!Amount.Value, "CA_Summary"), 0))
There are 3 Datasets in my report. The one I want is "CA_Summary" and the expression above was built with the expression builder.
The field, (Fields!COU_EMA.Value, "CA_Summary"), is a boolean (1 or 0) and I get error either with a 1 or a "true" (no quotes).
I probably could fix it if I knew what the definition of "scope" is. . . maybe.
The scope is where you want to look in order to get the values you're looking for. It could be a data set, group, etc. In your expression it appears CA_Summary is the scope.
I would try modifying the expression a bit. Since you say COU_EMA is bit field, maybe use TRUE. This is also assuming the matrix is using the data set CA_Summary.
=Sum(IIF(Fields!COU_EMA.Value = TRUE, Fields!Amount.Value, 0))
If your matrix isn't using that data set and it still doesn't work try
=Sum(IIF(Fields!COU_EMA.Value = TRUE, Fields!Amount.Value, 0),"CA_Summary")

SSRS 2008 - two datasets in one expression

My report has two datasets, main one and a second dataset (which holds only one row). I need to count how many values of a certain column in the main dataset are below a value taken from the second dataset. The expression I use is:
=Count(IIf(Fields!TestValue.Value < First(Fields!NetUnitWeight.Value, "SecondDataSet"), 1, Nothing), "MainDataSet")
& " of " & CountRows("MainDataSet")
But I get the following error:
[rsAggregateofAggregate] The Value expression for the textrun 'Textbox1.Paragraphs[0].TextRuns[0]' contains an aggregate function (or RunningValue or RowNumber functions) in the argument to another aggregate function (or RunningValue). Aggregate functions cannot be nested inside other aggregate functions.
I tried to solve it by putting First(Fields!NetUnitWeight.Value, "SecondDataSet") in a report variable, but this didn't work. How can I solve it?
OK, I found a workaround. I added a new report parameter, right-clicked it to open its properties, then clicked "Default Values". I selected "Get values from a query" and chose the dataset and value field I needed. Now this expression works without errors:
=Count(IIf(Fields!TestValue.Value < Parameters!NetUnitWeight.Value, 1, Nothing), "MainDataSet")
& " of " & CountRows("MainDataSet")

Multiple Datasets IIF Expression

I have 3 datasets in my project. I am trying to create an expression in a standalone textbox that reports "Error Found!" if the field.value is populated and "No Errors" if the field.value is blank.
=SUM(IIF(Fields!Account.Value = "","No Errors","Errors Found!"),"Account")
This is kicking back a "Report item expressions can only refer to fields within the current dataset scope or, if inside an aggregate, the specified dataset scope." error.
To avoid issues with multiple datasets, I added the SUM and the "Account" to reference the correct dataset.
If I were to replace my TRUE/FALSE with "1,0", the expression works.
Try:
=IIF(Isnothing(First(Fields!Account.Value,"Account")),"No Errors","Errors Found!")
Or you can use:
=IIF(CountRows("Account")=0,"No Errors","Errors Found!")
Where Account is the name of the dataset.
Let me know if this helps.

What is causing a scope parameter error in my SSRS chart?

Why am I getting this error in my chart? (Chart Image)
I am using this expression in the chart:
Series:
=Sum(Fields!Mins_Att.Value)/Sum(Fields!Mins_Poss.Value)
Series 1:
=Sum(Fields!Mins_Att.Value,
"Chart2_CategoryGroup2")/Sum(Fields!Mins_Poss.Value, "Chart2_CategoryGroup2")
and I am getting this error:
The Y expression for the Chart has a scope parameter that is not valid for an aggregate function.
The scope parameter must be set to a string constant that is equal the name of group, data region or name of dataset.
The scope of "Chart2_CategoryGroup2" doesn't exist in the report.

SSRS LookupSet with more than one Dataset in report

I am trying to use LookupSet in SSRS so that I concatenate a list into one textbox.
dataset1
TYPE |DESC
fruit |apple
fruit |orange
furit |grape
Results in
apple; orange; grape
Here is my ssrs textbox expression
=JOIN( lookupset( Fields!TYPE.Value,Fields!TYPE.Value, Fields!DESC.Value, "dataset1"), "; ")
It works as expected, until I add a second dataset to my report. The dataset does not have any of the same fieldnames used by my lookup expression. I do not change my textbox expression. My lookupset function is still referring to dataset1. I just get the error:
The Value expression for the text box ‘TEXTBOX1’ refers directly to the
field ‘TYPE’ without specifying a dataset aggregate. When the report
contains multiple datasets, field references outside of a data region must
be contained within aggregate functions which specify a dataset scope.
When I delete the second dataset, everything is works.
How can I use the LookupSet function in a report with multiple datasets?