Error in Calculations of simple formular in Reports
I create a Report related to Project transactions; Following is a dummy implementation of that. I create two separate reports to calculate Income and Expenses, then embedded two reports in main report and calculated difference between income and expense. when i print the Income value and Expense value in the main report it printed some value. but when i calculate the difference using same variables it gives unexpected values.
Result
Report design:
Formular: = $MonthlyExpenseRp_totalExpenses - $MonthlyIncomeRp_totalIncome i tried different formulars like, = CInt($MonthlyExpenseRp_totalExpenses) - CInt($MonthlyIncomeRp_totalIncome) but any of them did not works
Page 1 / 1
Hi @PDharmasena10
Could you please share how the fields are calculated in the sub reports?
Aleks
Hi @PDharmasena10 ,
Since your numbers appear to be currency, I would use CDbl rather than CInt.
Also, to troubleshoot this, you might try saving the values as variables in the main report and writing the formula as the difference of the two variables.
Hope this helps!
Laura
Hi @aiwan following is how i calculate the values in sub reports totalIncome =Sum(uARInvoice.CuryLineTotal]) totalExpenses = Sum(Abs(APMTran.Amount]))
these two values are calculated in two separate files
Hi @lauraj46 , I tried your solution but it still same I assign the value from sub report to a variable as bellow
Do the calculation like this : =$totalMonthlyIncome - $totalMonthlyExpense but it did not fixed the issue.
Hi @PDharmasena10
Thanks for that, looks fine, could you please share your report parameters for main report and sub report?
Could you also please share your joins?
Or share the report file please.
@aiwan Following is main report parameters
Sub report Parameters
Main report Joins
HI @PDharmasena10
If i remember correctly, you should try to keep the params the same for the main and sub report.
This means, as long as the sub report has all the main report params, plus any extras which you deem necessary to pull the right values, this should work.
Currently when you run the report, the sub report does not put any values in for the parameters except for project ID.
Have a look at the link below, it should help clarify:
@aiwan When embedding the sub report in the main report i have create the parameter list correctly. I think that is okay.
is there any issues?
Hi @PDharmasena10 ,
To troubleshoot this you could try making some changes to the subtraction formula. For example, try CDbl($MonthlyExpenseRp_totalExpenses) - 1. If that gives you the correct value then check the value of the other subreport. Maybe this will give you an idea of where the breakdown is occurring.
Also, try specifying a format string (e.g. #.00) for the calculated control.
Laura
@lauraj46 I tried with simple numeric formular (= 100 - 20), even that gives wired answers.
Hi @PDharmasena10
Do you mind sharing the report file so we can have a look?
@aiwan Hi herewith i have attached the report files, PM600014 is the main report. other two are sub reports.
I was able to fix this issue. I delete this textbox (UI element) and recreate it. then it was solved. I hope it may be a onetime error.