Multiple Datasets IIF Expression - reporting-services

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.

Related

Issues with Passing Multi-value Parameters to a Drill through Report

I have two reports were I pass multi-valued parameters to it's underlining data and both reports work very well independently. The parameter strings are being split using the function dbo.UTILfn_Split. When trying to drill from the main or Summary report into the sub or Detailed report all other parameters field in the report are populated except the multivalued parameter field. The parameter lists or value are listed in the detailed report but not selected and therefore cannot run the report even though the detailed report parameter property is set to allow multiple values. In both reports, the where clause is set "IN" not "=." How do I fix this?
In your Summary Report, when you pass the parameter to the sub or detailled report, the passed value parameter should be like this expression:
=join(parameters!yourMultivaluedParameter.Value,",")
after that, you pass the name of the parameter to the corresponding parameter in the dataset Detailled report.
In your SQL (SP), get the multivalues of the parameter by spliting it with your function
like following, depending of the result of your function, for exemple:
INNER JOIN dbo.SplitFunction( #yourMultivaluedParameter,',') tmp on tmp.yourColumn = ...etc...
Hope it helps...

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")

SSRS - Multiple Tablix Filters Based on Mutiple Parameter Values

I have an SSRS Report parameter set up with 3 different values ("Paid", "Denied" and "Open"). I want to set a tablix filter up so when the user selects one of the parameters, and a condition in the data is met, that row is returned. I want to give the user the option to select all there parameter values.
When I use the following Expression into the Tablix filter(Paid), it works correctly:
=IIf(Parameters!ClaimStatus.Value(0) = "Paid"
and Fields!TotalPaid.Value > "0"
, "Include"
, "Exclude")
If I try adding an additional filter(Denied) with the following Expression, neither filters work:
=IIf(Parameters!ClaimStatus.Value(0) = "Denied"
and Fields!Denied.Value > "0"
, "Include"
, "Exclude")
Is it possible to pass multiple parameters into a Tablix Filter? I've searched all day with no luck. Any help would be greatly appreciated. Thanks.
You should set up the filter to check the values in teh DataSet are 'IN' the multi-select parameter
In this example my DataSet has a field called Status which could be Open, Paid or Denied.
I also have a multi-select parameter as you describe above called ClaimStatus.
Using the IN operator makes the filter look for instances where Status is in the list of ClaimStatuses selected. Note the default when you add the ClaimStatus parmater as an expression is to add a (0) on the end. Remove this
When this runs and I select Paid and Open, only the Paid an open records are returned in the table that has the results filtered.
Hopefully this will work for you. Let me know if I can assist further.

Lookup function error in SSRS 2014

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.

Custom tablix filters in SSRS

I have a report which displays a table full of raw data.
Prior to entering this report, the parent report asks you to select a 'Service' & 'Department'
Depending on which Service/Department you select from the parent report, this RAW data will be filtered to show the relating data.
Straight forward enough, and it works, great.
I have a new requirement now.
If the chosen Service is equal to 'Service X' I need the data to be filtered again on that Service, department, but also to add aditional filter, on their 'team'.
so that the data will also be filtered where the team matches the user running the report's team.
I have a dataset already created which returns the user running the reports 'team'
And also a new parameter called 'team' which defaults to the user running the reports AD number'
The new requirement is, if the Service = X, then filter the data on the department but also on THAT users 'team', if the Service is not equal to X, do nothing.
I think I need to alter the Filters section of the Tablix Properties but am not sure what I need to put in the Expression, Operator, Value
So far I have tried =IIf(Fields!Service.Value = "Service X", Fields!Team.Value, nothing) in the Expression, set the Operator to In and tried filtering on the 'team' from my new dataset which stores the current users 'team' but it is not working.
Does anyone have any suggestions?
For these sorts of conditional filters I've had best results with using the IIf statement (or whatever) to return a string and filtering based on that, e.g. something like:
=IIf(Parameters!Service.Value <> "Service X" or Parameters!Team.Value = Fields!Team.Value
, "Include"
, "Exclude")
Then you can set the Operator to = and the filter value to Include. Just seems to a bit more robust in my experience.
Reading over this, you could even set the IIf statement up as a Calculated Column in the dataset and filter on that.