The value expression for the texttrun 'Textbox86.Paragraphs[0].TextRuns[0]' contains an error: [BC30451] Name 'IFF' is not declared - ssrs-2008

I am newbie and designing SSRS. Used Row Groups(DistrictName,StoreName,Employee_Name) and Column Groups (MetricsOrder,MetricsName,Year,Month).
Finally it prints 2 total value.
First it prints District Total and another one is the overall total. I need to Check some condition and the value may differ upon the condition.
Here is my expression. Checking weather is it current month. If so, multiply SUM values with RR(Parameter). If not, just print the SUM value
IFF((MONTH(TODAY())=Fields!Month.Value),Sum(Fields!MetricValue.Value)*Parameters!RR.Value,Sum(Fields!MetricValue.Value)
When i run the Report im getting the below error.
An error occured during local report processing. The definition of the
report '/Report11TRIAL2 is invalid'. The value expression for the
texttrun 'Textbox86.Paragraphs[0].TextRuns[0]' contains an error:
[BC30451] Name 'IFF' is not declared.
Could any one help me to fix this error.

I believe the expression should be:
IIF((MONTH(TODAY())=Fields!Month.Value),Sum(Fields!MetricValue.Value)*Parameters!RR.Value,Sum(Fields!MetricValue.Value)
IIF, not IFF.

Related

SSRS Grouping Summary - with Max not working

This is the data that comes back from the database
Data Sample for one season (the report returns values for two):
What you can see is groupings, by Season, Theater then Performance number and lastly we have the revenue and ticket columns.
The SSRS Report Has three levels of groupings. Pkg (another ID that groups the below), venue -- the venue column and perf_desc -- the description column linked tot he perf_no.
Looks like this --
What I need to do is take the revenue column (a unique value) for each Performance and return it in a separate column -- so i use this formula.
sum(Max(Fields!perf_tix.Value, "perf_desc"))
This works great, gives me the total unique value for each performance -- and sums them up by the pkg level.
The catch is when i need to pull the data out by season.
I created a separate column looks like this
it's yellow because it's invisible and is referenced elsewhere. But the expression is if the Season value = to the Parameter (passed season value) -- then basically pull the sum of each of the tix values and sum them up. This also works great on the lower line - the line where the grouping exists for pkg -- light blue in my case.
=iif(Fields!season.Value = Parameters!season.Value, Sum(Max(Fields!perf_tix.Value, "perf_desc")), 0)
However, the line above -- the parent/header line its giving me the sum of the two seasons values. Basically adding it all up. This is not what I want and also why is it doing this. The season value is not equal to the passed parameter for the second season value so why is it adding it to the grouped value.
How do I fix this??
Since your aggregate function is inside your IIF function, only the first record in your dataset is being evaluated. If the first one matches the parameter, all records would be included.
This might work:
=IIF(Fields!season.Value = Parameters!season.Value, Sum(Max(Fields!perf_tix.Value, "perf_desc")), 0)
It might be better if your report was also grouping on the Venue, otherwise you count may include all values.

Fix the "Cannot mix aggregate and non-aggregate arguments with this function" error when creating a calculated field

I need to create a Dimension (calculated field) that depends on a filter.
My dataset has four columns: ID (Int), Variable Name (String), Value (Int) and Client ID (String). For each client ID there will be a value for each type of variable.
There are 6 types of Variable Name, and for each row there is unique ID.
I'm using a filter by Variable Name so there is one, and only one variable type available at the same time.
In order to display it in a stacked bar chart by that dimension, I have created this calculation field (In reality if has six IFs, but I'll use just one to illustrated it):
IF ATTR([1 (ML_Output)].[Variable Name])= "Interest Rate" THEN [Interest Rate] END
That way, when the filter is in "Monthly Interest Rate", the ATTR function should show the only type of variable available in the Variable Name field, which would be "Monthly Interest Rate". The problem is that it shows the "Cannot mix aggregate and non-aggregate arguments with this function" error.
I've been trying to solve this with many tutorials, but none of them work for one reason of another.
Any ideas?
EDIT:
PS: The original calculation that was doing what I wanted used a Parameter. However, since parameters won't update automatically when the dataset changes, I can't use it anymore. The original calculation was:
IF [Parameter 1]="Interest Rate" THEN [Interest Rate] END
I need the calculated field as a dimension. So, if I aggregated the result of the calculation, then it would be a measure, and that can't be used to create a stacked bar.

SSR Sorting Expression using Report!Items

I have a report using Matrix table group by Business with Sub-total and grand total. I have a calculated field called "% of Received" column that uses Report!Items in the detail row, and I want to sort it from highest to lowest value =ReportItems!MTDPACount.Value/ReportItems!MTDLOBTotal.Value, but it is giving me an error that Report Items cannot be used in expression. Please advise.
Thanks
Have you checked whether some of the ReportItems!MTDLOBTotal.Value are NULL or 0? If so, treat ReportItems!MTDLOBTotal.Value first, add ISNULL and WHERE column != 0 to your query or Stored Procedure to filter out those invalid denominator. Or you could directly add condition in the expression to treat 0 or NULL for your ReportItems!MTDLOBTotal.Value

Problems converting a crystal reports running total string to a number

I have a problem with converting a running totals string to a number.
The running total is set to retrieve the maximum value of a field that contains results. It is reset with change of a group and evaluated by a formula so that only results from a specific test is used.
The result database field is a string since there are test with text results as well as tests with numeric results in the database. The test I'm filtering out only have numeric results (saved as string).
The running total works fine and gives the correct result, but I want to change it from a string to a number to be able to set the number of decimals and use rounding in the report, and this is where my problem begins.
As far as I can tell there is no way of using the format field in this case. (Which is resonable since it is a string field.)
I've tried using a formula field with the following formula:
if isNumeric({#P-LDL}) then toNumber({#P-LDL})
but that returns 0.00 for all non-null values even though the strings are nice things like "2.36" or "3.74" (without the quotes).
I've also tried the old school approach of resetting a global variable in the group head, assigning it a value in the details section when a post with the correct test comes along, and then finally display it in the group footer, but I get the same 0.00 result. I've tried both using a numeric global variable and do the conversion on the details-level, and using a string variable and do the conversion in the footer-level.
Solved it:
if NumericText(Replace({#P-LDL}, ".", ",")) then
ToNumber(Replace({#P-LDL}, ".", ","))
Stupid locales...

How can I create grand result in crystal report?

I have a field there in my report its called result. It shows something like that
PASS
PASS
PASS
PASS
or
PASS
FAIL
PASS
PASS
I want to make a custom formula to show grand result. If that specific(result) field keeps all PASS value then it will show PASS there in grand result else it will show FAIL(If result field keeps at least one fail value.) I don't have enough idea about crystal report scripting so would you please show me example? I have used following code if {res_info.res} = "PASS" then
"PASS"
else
"FAIL"
but it shows pass if last row gets pass value & shows fail if last row gets fail value. All I want to do it that it will check all values of result field & if it gets at least one fail value grand result will show fail else it will show pass. I am just a beginner so please add example with your answer.
There are a few ways to accomplish this. The quick and dirty way is to add a Summary field. Right-click on your result field and select "Insert" then "Summary". Select the minimum aggregate function under "Calculate this summary" and select "Grand Total (Report Footer)".
This will return the minimum value for that field (in the case of a string, the minimum in alphabetical order which is FAIL if it appears, otherwise PASS) for all records.
I'm on Crystal Reports 2008, so your version's steps might be slightly different.
You can keep a second variable that instead of storing either "PASS" or "FAIL", it will store 0 for "Pass" and 1 for "Fail".
Then, in the grand total, you can create a formula field that takes the SUM of your variable, and if it is greater than 0, show "Fail"; otherwise, show "Pass".