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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xi - extract sum from a date period

Status
Not open for further replies.

campia

Technical User
Apr 20, 2007
77
BE
Hi,

In a cross-tab I have a Total of minutes per moth (I enter a date period).

Is it possible to store this total in a field because I need to calculate with this total?
I tried this:

Local NumberVar x
x:= Sum ({Object.Grand_Total}) in {?StartDate} to {?EndDate}

Thanks,
André

André
 
Need to give more detail.

You can not use your formula within Crosstab so what are you trying to do?

Show a rough layout of report showing what you want to achieve.

Ian
 
If you want to total for a date range, you can do this using a running total. If you're not already familiar with Crystal's automated totals, see FAQ767-6524.

It helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods sometimes change between versions, and higher versions have extra options.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
if {Object.Customer_Title} = "Test1" or {Object.Customer_Title} = "Test2" then

Local NumberVar TMin_beginContact := 1680;
Local NumberVar TMin_used ;
Local NumberVar TMin_beginMonth;

if month(currentdate) = 1 then
TMin_used := TMin_beginContact / 60
else if month(currentdate) = 1 then
TMin_beginMonth := TMin_used
else
TMin_used := sum ({Object.Grand_Total}) / 60

else if {Object.Customer_Title} = "Test3" then

Local NumberVar TMin_beginContact := 700;
Local NumberVar TMin_used ;
Local NumberVar TMin_beginMonth;

if month(currentdate) = 1 then
TMin_used := TMin_beginContact / 60
else if month(currentdate) = 1 then
TMin_beginMonth := TMin_used
else
TMin_used := sum ({Object.Grand_Total}) / 60

I have the error on the second part of the big IF telling me it seems it's not part of my formula
Any idea?

André
 
YOu have conflicting else you need to wrap the nested if then else in brackets

if month(currentdate) = 1 then
TMin_used := TMin_beginContact / 60
else
(
if month(currentdate) = 1 then
TMin_beginMonth := TMin_used
else
TMin_used := sum ({Object.Grand_Total}) / 60
)
else if {Object.Customer_Title} = "Test3" then

Local NumberVar TMin_beginContact := 700;

YOu do not have a default ie what happens when both top and bottoms ifs are NOT true.

Ian
 
Ok thanks...

however i still do not have the result I'd like...

What i'm trying to do is a formula to calculate the total of minutes spend for the year...
At the end of the month I have in a cross-tab a column with the total of minutes spend for the month.
Let's imagine at the end of this month I have 500. Next month I have 200.

I need to be able to store the 500 to use it next month to do the calculation: minutes used: 200 + 500 (month before)... How can i store the value from month before ? Is there a possibility?

Thanks

André
 
Cross tabs do not work this way. Is there not a simple database field that holds minutes per record?

No version of crystal "stores" data. The data must exist in the database. I rarely run across a reason to store data somewhere outside of the database itself.

All of your formulas and questions are based on a preconceived idea of how crystal works. Please just post some of your sample raw data, and desired output.


Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
in my report i have fields:

intervention date
responsible
effort time
description

At the end of the month I can follow the different activities from the users and their time effort.
After that I use a cross-tab to see the end result like the intervantions per user and the total of minutes... but that's all i have in the report... I use a StartDate and EndDate parameter to specify the month and to have the statistics...

in the report header i created a formula in which i'd like to show the minutes used for the year. Each month this value show increase: Total of minutes last month + total of this month

André
 
do you have an email address maybe that i can use to send you the report and then i'd be able to explain the calculation i'm trying to do ??

andré

André
 
You have to stay within the forum. If your goal is to show the YTD total in the report header, while the report proper shows data only for the current month, then use a subreport in the report header that is not limited to the current month.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top