Formula to Sum "amount" column in Crystal report - crystal-reports

I have a column name as "Amount" in CR. I need to sum that column.
I created a new formula and tried sum( { MycolumnName} ) and it says
"A number field or currency amount field is required here"
Is there any way to apply conversion in formula itself.

Why create a formula when you can just create a summary field by selecting your column and going to the menu and selecting Insert Summary, Insert Subtotal or Insert Grand Total depending on your needs? You can place the summary field in a group section as a subtotal, or in the report footer as a grand total.
If you need to apply a conversion in the formula, you can use CCur like this:
sum( CCur({ MycolumnName}) )
More information on converting types in Crystal Reports can be found here.

Change the type xs:string to xs:decimal of the column MycolumnName in xs:element in .xsd page

Related

How to implement a conditional fomula in Crystal Report

I have a table named tblRecovery with 4 column. ID, LStatus, Amount and RecoveredBy I created a formula to sum Amount Column where LStatus Column value is "WCL". I use following code.
It sum all value of Amount column without condition. I want to sum amount column if Lstatus Column value is "WCL". How can I do that?
if {tblRecovery.LStatus}='WCL' then sum({tblRecovery.Amount})
Crystal Reports formulas work on a per-record basis.
Your current formula shows the sum of tblRecovery.Amount on every single row where LStatus='WCL'.
To get the desired result, create a formula-field with following formula and the create a sum of it:
if {tblRecovery.LStatus}='WCL' then
{tblRecovery.Amount}
else
0

SUB TOTAL in crystal report

I to try to get subtotal of these numbers through formula but sub total is wrong please check this image
check image
image
i use this formula here locamount is feild name and #test is parameter..
if isnull ({#test})
then {dt1.locamount}
else
{#test}
#test parameter
if {dt.acdocno}+{dt.fiscalyear} = {esy.InvRef1}
then
{esy.Invpmt1}
else if
{dt.acdocno}+{dt.fiscalyear} = {esy.InvRef2}
then
{esy.Invpmt2}
else if
{dt.acdocno}+{dt.fiscalyear} = {esy.InvRef3}
then
{esy.Invpmt3}
else if
{dt.acdocno}+{dt.fiscalyear} = {esy.InvRef4}
then
{esy.Invpmt4} ......
above code continue till 50 number comes
i click on insert fields and select formula field then i write formula and save this as SUB_TOTAL then drag this field i.e. subtotal on report
how to solve this
I might be missing something obvious, but... you should be able to accomplish this by using grouping and summaries or running totals
In your report, go to Report > Group Expert. Select the field you want a subtotal on (VendorNo)
Create a running total for the field you want to summarize - If you want to summarize a computed field, then first create a formula for the computed field (say, {dt.acdocno}+{dt.fiscalyear}), then use that formula as your field to summarize in the running total.
The results should look like this
If this isn't what you need, could you provide some detail about the report design and tables used?

Getting sum of multiple fields in crystal reports

how to calculate {SUM} of multiple columns into a one column in In my Crystal reports.
Total=(VAT+TAX)
ok this how in general it works:
Place your data in detail section and take simmary in report footer, You can take that by right click ojn field and use insert summary option.
Now create a formula #Total
sum(Vat)+sum(tax)+sum(duty) //you can select the summary fields from report fields
Place the formula in report footer

Crystal Report Sum of a Column data

I have field GrandTotal in my dataset which I am showing in my report. I want show the total of all data in the footer .
My column data are string .
I tried to make a formula as bellow
SUM(ToNumber({Ds.Grandtotal}))
But its saying a field is require.
You must convert the field into number, and then try to get the sum.
Step 1: Create a new formula from field explorer, give a name to formula (relevant name).
Step 2: Convert the field into Number.
Step 3: Then Add Sum of the formula field
Step 4: Place that Formula field into the Report Footer.
Add Formula:
Choose Field to Convert into Number or Currency:
Then After Field Conversion, get the Sum of the Formula field by choosing name of the formula from the Report fields.
Formula field has fx as prefix.
Try below solution.
Create a formula and write formula as
ToNumber({Ds.Grandtotal})
now place this formula in details section.
Now write on the placed formula and click on summary and insert summary to grand total.

Crystal Reports: Is it possible to sum for more than one column?

I work on an accounting project in .NET.
I want to sum all transaction and its opening balances.
I use summary but it Allows only one column..
You can summarize within formulas, so long as the formula field is present in the report footer. When using Sum() CR knows to evaluate the expression for all records returned.
So you would create a formula for the report footer, and the formula code would be something like:
Sum({#TransactionAmt1}) + Sum({Transactions.Amount}) + Sum({#AnotherFormula});