Question

Error in Calculations of simple formular in Reports


Badge

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


11 replies

Userlevel 4
Badge

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

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
 

 

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 4
Badge

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.

Badge

@aiwan Following is main report parameters
 

Sub report Parameters
 

Main report Joins
 

 

Userlevel 4
Badge

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)

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

Badge

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

 

Userlevel 4
Badge

Hi @PDharmasena10 

 

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

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved