Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula to Sum up field values and display in one line

Status
Not open for further replies.

paulrn

Technical User
Jun 3, 2004
4
US
Hi All ,

I am new to CR,I working on report where I need to sum all expense amounts by expense type and show it as single amount in single line,

Present Report
--------------

Airfare 180.00
330.00
219.00
240.00

Meals 40.00
80.00
60.00
100.00

Hotel 200.00
300.00
500.00
600.00

Required Report
---------------
Airfare 969.00
Meals 280.00
Hotel 1600.00

Thanks in advance for your help

prn

 
Not sure what version of CR you are using but this is what I use with CR8.5 on an Oracle DB

1. Insert a group by ExpenseType
2. Right click on the ExpenseAmount in the Detail section and click Insert and then summary. From the pop-up Insert Summary window, select SUM on Group ExpenseType
3. Suppress the detail section

That should give you totals by Expense Type
 
Hi,thanks for your response.i am working on CR Version9.X
and SqlServer database.I forgot to mention that ExpenseType is derived by formula @Tst,ExpenseAmount is derived from @Amount,I tried your approach EXPENSE AMOUNT values are repeating,do i need approach to different way,plse advise.

Thanks

 
You need to understand your data.

If it's repeating, then you need to fix that.

You're posting very little tecchnical information.

You state that you have formulas, but not what is in them, nor where they are.

You might select Database->Select Distinct Records if the rows are dupes, but they're probably not true dupes.

Note that your example data didn't show any dupes, so your initial post was incorrect, please provide accurate examples if you want accurate answers. Wichita gave you a good solution, you just asked the wrong question ;)

Take the time to provide meaningful information, and you'll probably get a great solution here.

-k
 
You should share the contents of your formulas. If you are able to group on {@Tst}, then you could use a running total if expense amounts are repeating (In your example, you showed no repeating values). You must have an ID field within which the expense is repeating--the field that lets you know that the repeated value is not a genuine value, but instead is a duplicate. Let's call this field {table.ID}. Then go to the running total expert and choose {@expense}, sum, evaluate on change of field {table.ID}, reset on change of group {@test}.

-LB
 
I agree that Wichita gave good answer for the question,I have shown the contents of the formula,it may help what i am trying to achieve in this report.
@Tst
----
if{NPR5016_V2.RESOURCE_CATEGORY} <> 'INTIM' then
{NPR5016_V2.RES_SUB_CAT_DESCR}

@Amount
-------
if {NPR5016_V2.RESOURCE_CATEGORY} <> 'INTIM' then
{NPR5016_V2.NET_EXTENDED_AMT}
else
0
Both are field formula's in detail section.
In my question,I have referred @Amount as EXPENSE,and
@Tst as EXPENSETYPE,based on the above formula these values are derived.
When i run the crystal,output is as below:
Airfare 180.00 (need to sum up all these value)
330.00
219.00
240.00

Meals 40.00(need to sum up all these value)
80.00
60.00
100.00

Hotel 200.00(need to sum up all these value)
300.00
500.00
600.00

Required Report should be as below:
---------------
Airfare 969.00
Meals 280.00
Hotel 1600.00


Thanks in advance for your help.
 
From what you are showing, Witchita's solution should work fine. In other words, you still have not shown what the problem is. Are you getting inflated results? Be sure you are inserting the summary on {@Amount}, and not on{NPR5016_V2.NET_EXTENDED_AMT}. If this still doesn't work, then you must have either suppressed records or a group selection formula. If either of these is true, you must share the contents of your suppression formula (in the section expert) or of your group selection formula.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top