Skip to main content
Solved

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:
 

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

13 replies

Userlevel 5
Badge +2

Hi @PDharmasena10 

 

Could you please share how the fields are calculated in the sub reports?

 

Aleks

Userlevel 7
Badge +8

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

Userlevel 2
Badge

Hi @aiwan following is how i calculate the values in sub reports
totalIncome  =Sum([ARInvoice.CuryLineTotal]) 
totalExpenses = Sum(Abs([PMTran.Amount]))

these two values are calculated in two separate files
 

 

Userlevel 2
Badge

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.

Userlevel 5
Badge +2

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.

Userlevel 2
Badge

@aiwan Following is main report parameters
 

Sub report Parameters
 

Main report Joins
 

 

Userlevel 5
Badge +2

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:

S150 Report Designer 2024 R1 (acumatica.com)

Userlevel 2
Badge

@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?

 

Userlevel 7
Badge +8

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

Userlevel 2
Badge

@lauraj46 I tried with simple numeric formular (= 100 - 20), even that gives wired answers.  
 

 

Userlevel 5
Badge +2

Hi @PDharmasena10 

 

Do you mind sharing the report file so we can have a look?

Userlevel 2
Badge

@aiwan Hi herewith i have attached the report files, PM600014 is the main report. other two are sub reports.

Userlevel 2
Badge

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.

Reply