XI Sp2 running totals formula working strange
Post Author: oskaratk
CA Forum: Formula
Hi,I seem to have a problem with a running totals formula:for totaling, in the detail band: formula "totalall"WhilePrintingRecords;CurrencyVar balance;CurrencyVar grs_amt;grs_amt := grs_amt + { detail.bal_grs_amt};balance := balance + { detail.bal_balance};''; display in group footer:WhilePrintingRecords;
CurrencyVar balance; in case the first record has a negative value, it is not subtracted from balance if I switch the order the statements are executed
balance := balance + { detail.bal_balance};grs_amt := grs_amt + { detail.bal_grs_amt};
''; balance is updated correctly also, in case I created a formula for each varible to be totaled, that works; like:formula "totalgrs_amt" WhilePrintingRecords;
CurrencyVar grs_amt;
grs_amt := grs_amt + { detail.bal_grs_amt};''; formula "totalbalance" WhilePrintingRecords;
CurrencyVar balance;
balance := balance + { detail.bal_balance};
''; Am I missing something, is this intended bahavior or maybe a bug? Thanks for any hintsOskar
I found that putting them in the footer works, but in the header does not. Formula fields can summarize in the header. But running total fields cannot???
Thanks,
W.
Similar Messages
-
Getting running total formula result at the beginning of the report
Hello All,
I am having an inquiry that if I can get a grand total in the report footer to the report header.
The grand total is not a direct sum. I am using three formulas
the first formula:
@reset Group Header
whileprintingrecords;
numbervar sumpct4;
if not inrepeatedgroupheader then
sumpct4 := 0;
the second formula: Details section
whileprintingrecords;
numbervar sumpct4 := sumpct4 + {@Total_Market}; // {@Total_Market}; = Amount+ Interest
numbervar grtotal4 := grtotal4 + {@Total_Market};
Group Footer
whileprintingrecords;
numbervar sumpct4;
Report Footer
whileprintingrecords;
numbervar grtotal4;
All that I need is to show the total which is in the report footer at the top of the page where I am having a summary.
So, can you please help me.
Thanks
Edited by: maas maas on Sep 8, 2010 12:48 PMHello my friend,
I want this to be controlled in crystal.
Is there is a way to get the grand total by using multiple formulas or any other way?
Here is the structure of my report:
Group Header 1: CCY
Group Header 2:Type
@reset Group Header
whileprintingrecords;
numbervar sumpct4;
if not inrepeatedgroupheader then
sumpct4 := 0;
Group Header 3A: Deal No
Group Header 3B: Deal No (subreport to get the {@amount} for each deal)
I will pass the end_date from the main report to subreport and I will get the sum(amount) for each deal between date (1-1-2008) to end_date. The sum will be as a shared variable to the {@amount} formual in the main report.
Details:
Deal No, {@amount}, {@Price}, {@market}, {@Total_Market}
{@Price}: if {table.price} = 0 then
100
else {table.price}
{@market}: if Type <> "DEP" then
({@amount}*{@Price})/100
else
{@amount}
{@Total_Market}:{@market}+ {@Price}
Running formula to get Total_market: Details section
whileprintingrecords;
numbervar sumpct4 := sumpct4 + {@Total_Market};
numbervar grtotal4 := grtotal4 + {@Total_Market};
Group Footer 3B: Deal No
Group Footer 3A: Deal No
Group Footer 2:Type
In this group I am placing a running total formula:
whileprintingrecords;
numbervar sumpct4;
Group Footer 1: CCY
Report Footer:
@grand_Total
whileprintingrecords;
numbervar grtotal4;
Now, i want this @grand_total formula result to be shown in Group Header 1: CCY.
I tried to insert a subreport at the beginning which it is a copy of the main report, but I did not get the coorec t result because I am getting the {@amount} from a subreport and in crystal I can't insert a subreport in an existing subreport. -
How to create a running total formula for different calendar years
Hello everyone,
I am looking for some help in creating a running total formula for different calendar years in Oracle. This is what I currently have organized in the crosstab report: vertically I have the cities from our database organized, then horizontially have the following information for each city:
2006 /2007 /2008
Amount /Amount Spent /Unspent Amount Amount Recieved/Amount Spent /Unspent Amount Amount Recieved/Amount Spent/Unspent Amount
Recieved
I am trying to create a formula that will specify each calendar year. For example, I'd like to have a formula in 2007 which would total the: 2007= {2006 unspent amount + the unspent amount in 2007} and same for 2008= {2007 unspent amount + the unspent amount in 2008}. I hope this is clear, I have simplified the report into a basic interpretation of what i've been trying to accomplish.
Would anybody know if this is possible and how to approach this?
Really appreciate it! Thanks.
AlexHi,
you can try and define a running total as a calculation in the crosstab as:
sum(Unspent Amount) over (partition by city order by year)
i find the crosstab format comfusing sometime since the aggregation is auto applied.
I would start with a flat table and then "duplicate is as a cross tab"
for your running total you can sort the data by the city,year and get it to 3 lines for each city, for example:
city year Unspent Amount all other amount...
X 2007 10
X 2008 20
X 2009 30
Y 2007 5
Y 2008 15
Y 2009 25
then you can use a funtion to calculate the amount :
sum(Unspent Amount) over (partition by city order by year)
this is the sql i used just to check it:
SELECT city,year,"Unspent Amount"
,SUM("Unspent Amount") over (PARTITION BY city ORDER BY YEAR)
FROM (
SELECT 'X' city, 2007 YEAR, 10 "Unspent Amount" FROM dual UNION ALL
SELECT 'X', 2008 ,20 FROM dual UNION ALL
SELECT 'X', 2009 , 30 FROM dual UNION ALL
SELECT 'Y', 2007 , 5 FROM dual UNION ALL
SELECT 'Y', 2008 , 15 FROM dual UNION ALL
SELECT 'Y', 2009 , 25 FROM dual
Tamir -
Running Totals, formula statement works one way, not the other
Here is the problem in a nutshell...
I am designing a report where I am using 2 running totals based on whether a SQL Stored Proc dataset field (text) is Null or Not Null... So I design the 2 running totals and put this code in each "Evaluate"
IsNull({usp_rpt_RemediationData;1.Action})
- and -
NOT IsNull({usp_rpt_RemediationData;1.Action})
The FIRST one works. The SECOND one does not - that is, it does not add a count for it.
In other words, I am just cycling through a table and counting 1 field, checking whether its Null, or not.
Why doesnt this rather simple and straight forward thing work!!!!????
Any help would be most appreciated.The statement...
NOT IsNull({usp_rpt_RemediationData;1.Action})
DID NOT work when used as part of a running total - even adding the check for blank instead of just null (though the field is truly null).
However, using the EXACT same statement in a formula written for running totals - it does work...? Go figure... I cant explain it.
But thanks for the help! -
Dear all,
I am creating a new report which needs a conditional running total.
I need to sum the credits quantity if the following condtions are met
line_type="S" and
line_no<3
I used running total like this
Field to summarize: lab_credits2.credit_qty
Type of Summary: SUM
Evaluate: Use formula
{lab_credits2.line_type}="S" and
{lab_credits2.line_no}<3;
Reset: On change of group (Reason Code).
When I ran the report, it did not produce the right results, so I placed the line type and line no into the same Group footer and ran the report.
I found out that the report is not filtering the linetype and line no.
Result shows
Line Type ="S" - 100 - Line number =1
Line Type = "M" - 200 - Line number=6
and so on.
The report is grouped by Reason Code.
Any ideas why would it not be filtering the records?
Report Record Selection Code
{lab_credits.credit_date}>={?startdate} and
{lab_credits.credit_date}<={?enddate} and
{lab_credits.credit_status} = 2;
Status=2 is needed there to filter the Order numbers correctly.
Many thanks
Regards
JehanzebThanks James,
I have put all three in detail and used the filteration and it worked under detail section however the results when used in total SUM is produced incorrectly.
I suspect it might be of database table linkage? or maybe I have done something wrong in the report.
I am going to create another report and see if that works.
Will post info here.
Regards
Jehanzeb
Edited by: Jehanzeb Navid on Sep 4, 2008 11:55 AM
Right I found the issue however I don't know how to resolve it.
I have 4 tables in the database
1: Lab Credits - Order_num, Credit_status, Reason_code
2: Lab Credits2 - Order_num, Line_no, Line_type, Credit_qty
3: Lab Reasons - Reason_code,Reason_description
4: Oetrn2 - Order_num
This is how they are linked up
Lab_Credits_Order_num = Lab_credits2_order_num and oetrn2_order_num
Lab_Credits_Reason_code = lab_reasons_reason_Code
Report Grouping
Grouped by Reason Code
Date range - month to date
Report Record Selection
{lab_credits.credit_date} in monthtodate and
{lab_credits2.line_no}<3 and
{lab_credits2.line_type}="S" and
{lab_credits.credit_status}=2;
Now the issue
When I add sum of qty of lab_credits2_credit_qty into the report Group footer,it produces the right results However when I add
DistinctCount of Oetrn2_Order_num into the Group footer, it creates totally different Sum of Lab Credit Qty results. (Please note: The oetrn2_order_num results appear fine, however they messup Sum of Lab_credit_credit_qty).
What do you think where am I doing wrong?
It has to be something to do with table linkage.
Regards
Jehanzeb -
I am trying to subtract a list of numbers from a begining number.
Example... I have 480,000 parts...... I have a list of usage by week. I am trying to get a balance after each week.
Here is what I am trying to get
Starting 480,000
10/5/2008 10,000 470,000
10/12/2008 15,000 455,000
10/19/2008 5,000 400,000
ect.....
I am trying to get a formula to create my running total (shown in bold)
Any suggestions?Hi Travis,
try creating a formula like
@initialize:
whileprintingrecords;
numbervar i:=480,000;
place this in report header
and create one more like
@Evaluate:
whileprintingrecords;
numbervar i;
i:=i-;
Place this beside the amount field.
Regards,
Raghavendra -
Running Total not working correctly
I have a running total setup inside a for loop, the problem is that the running total isn't "running" . Below is the syntax
<?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,3,1)?>
<?xdoxslt:set_variable($_XDOCTX,’DUPE’, xdoxslt:get_variable($_XDOCTX, ‘DUPE’ ) +1) ?>
<?for-each-group@section:/ TMP008/LIST_G_ORDER_BY/G_ORDER_BY/LIST_G_INVOICE/G_INVOICE;G_INVOICE?>
TABLE HERE+_
<?end for-each?><?end for-each?>
I am using this loop to print 3 copies of an invoice, then by using the running total I am trying to call a unique footer on each copy by having the following code in the footer.
<?choose:?>
<?when: xdoxslt:get_variable($_XDOCTX,’DUPE’)=”1”?>
<?call:Footer1?>
<?end when?>
<?when: xdoxslt:get_variable($_XDOCTX,’DUPE’)=”2”?>
<?call:Footer2?>
<?end when?>
<?otherwise:?>
<?call:Footer3?>
<?end otherwise?>
<?end choose?>
What is happening is the first copy is using Footer 3 and the other 2 copies are using Footer 1. FYI at the top of the rtf I have a import statement and set_variable statement as shown below:
<?import:file:///C:\Documents and Settings\username\Desktop\MasterFooter.rtf?>
<?xdoxslt:set_variable($_XDOCTX,’DUPE’, 0)?>
The variable DUPE is getting the value 1 on every page which I don't quite understand.
Any help would be greatly appreciated. I can attach the xml file and rtf if so desired. ThanksFirst initialise a variable and assign it value zero (with this code..)
<?xdoxslt:set_variable($_XDOCTX, 'RunTotVar', 0)?>
then embed the following code within the for loop where you want the running total displayed..
the code below shows a running total for the xml field INVOICE_AMT
<?xdoxslt:set_variable($_XDOCTX, 'RunTotVar', xdoxslt:get_variable($_XDOCTX, 'RunTotVar') + INVOICE_AMT)?><?xdoxslt:get_variable($_XDOCTX, 'RunTotVar')?>
Hope this helps. its from one of the examples provided with the template builder for word.
-Domnic -
Running Total Grouping Formula
I have a running total condition that I need to summarize the field CAWP.BAC. I would typicaly evaluate this total for change of group 4 and reset on change of group 3. I need to condition the evaluation for ".900" in {CAWP.WP} but i also need to evaluate for change of group 4. Does any one have any examples of a formula for evaluation "on change of group"?
Hi John,
For this you can try using manual running total formula's.
1) Create a @reset formula as below and place it in group header 3.
Formula :
Whileprintingrecords;
Numbervar i:=0;
2) Create an @evaluation formula and place it in detail section.
Formula:
whileprintingrecords;
numbervar i;
if {CAWP.WP} = ".900" then
i:= i+ {CAWP.BAC}
3) Create a @display formula and place it in group footer 4.
Formula:
whileprintingrecords;
numbervar i;
Hope this will help!!
Regards,
Vinay -
Running total across 2 grouping
Hi All
I have created a crystal report and i have 2 remaining issues that i just cant get around.
the report is basically about all the net stock position.
the report is based on a query..that links sales order to all target documents that originate from the sales orders, i.e...deliveries, invoices, returns, credit notes.
then i also brought in all the open purchase orders and the instock from the oitw
i then sumed up the lines so the sales order > Delivery > invoice > credit note > returns all shows in one line..and if there is a different unit of measure it will be another line for that sales order
the report is grouped:
per warehouse
per item
per Sales Order Num
per Item Unit of Measure
per Line Num
1st issue:
in the selection criteria if the sales order is closed but if one of the delivery notes is open it should bring in the "whole set" not just the the open deliverys linked to the sales order.
this is because the delivered quantities adds up to the net position of the stock.
2nd issue:
I have to work out a net postion
formula: net stock = Oitw.instock + PO - remaining qty on sales order
I got the sales order as a negative
i used a running total formula, but it does not work if the sales order has more then one unit of measure.
whileprintingrecords;
If onfirstrecord or previous({Command.SO No.})<>{Command.SO No.} then
numbervar remain_bal:= remain_bal + {@QTY}
i tried to add another if statement..but does not work
whileprintingrecords;
If onfirstrecord or previous({Command.SO No.})<>{Command.SO No.} then
If onfirstrecord or previous({Command.SO Uom)<>{Command.SO Uom.} then
numbervar remain_bal:= remain_bal + {@QTY}
any help will be gladly welcomed..
thank you all
JerushaHi Dave
Thank you very much for your feedback.
I have been using the base UoM, ie InvQty field.
my issues comes where i am grouping I am 1st grouping by sales order num, then by uom as the customer wants to see that as separate entries
Example:
SO Num Uom Qty InvQty
1 Bags 50 200
1 Bulk 100 100
This is the forumula for the running total:
If onfirstrecord or previous ({Command.SO No.}) <> ({Command.SO No.}) then
if ({Command.Doc Type}) = 'SO' then
SO := SO + {@QTY}
However when i "print" my total and add it to the footer.. it will show 200 instead of 300.
Thanks
Jerusha -
Running Total on a Running Total
Post Author: MikeA-ICE
CA Forum: General
I have set up a running total on a field in a subreport and it is calculating correctly. I set the running total in the Report Footer of the report, then I created a variable which passes the running value back to the main report. The variable is placed in a Group Footer on the main report and it resets on each change of the group. However, now I need the grand total of that running total to appear in the Report Footer of the main report. I created a manual running total formula and placed it it in the Report Footer of the main report. Here it is:NumberVar Sect2MatlTotal;WhilePrintingRecords;NumberVar Sect2MatlTotal := NumberVar RunningSect2MatlTotal + {@Material$Var2a} The problem is that the value that comes out is grossly larger than it should be. It should be $112,350,582 but it comes back as $212,603,556, which is nearly double what it should be. Can anyone suggest a method that would allow me to place the running total in the Report Footer of the main report and get the correct value that is visible in the Group Footer just above it?Post Author: V361
CA Forum: General
you may need to select evaluate on group, or reset on group to get this to work. or just use the shared variable to bring the total down. -
I have a running total that works beautifully but I cannot get the percentage correct.
When I create a number var using the RT the percentage also does not come out correctly.
Suggestions please?
Thank you,
JenHi Abhilash,
I have a report grouped by
Group 1 Provider
Group 2 Medication
Group 3 Med Ordered Date
Group 4 Patient number
Running total 1 is:
Count pt ID number on change of Group 4 Patient Number reset on change of Group 2 Medication.
Placed in Group Footer 2
Running Total 2 is:
Count pt ID number on change of Group 4 Patient Number reset on change of Group 1 Provider.
Placed in Group Footer 1
The below is showing the running totals in action and the percentages to the right of the count. 4/76*100 is 5.26.. Can't figure out where the 100% is coming from, as well as the other percentages.
Formula for the percentage:
{#RT Med GF2}%{#RT Med GF1}
Thanks for your help. -
Hi All
I believe I have posted this question previously with no luck, but I have notice a few very clever new people so I will try again.(I have been working on this report for weeks and it is driving me nuts!!!)
I am using CRXI and have created a main report with a figures shown from two subreports. I have successfully created shared variables on both subreports (in details section a) and have created a running total to give me a total of figures (in details section b) from said subreports. I also have a group that I want the same calculation done as in the details section, eg;
Group1
details subreport1 subreport2 runningtotal (subreport1+subreport2)
$100.00 $150.00 $250.00
$ 50.00 $150.00 $200.00
$450.00 This is what I need to produce.
I thought that if I reproduce the running total formula and place in the group header and footer would have worked, but no. I have also declared new shared variables and used those in group header and footer, but all I get is the total of the last record in details.
I have a nasty feeling that I am missing something really stupidly obvious but can't see the trees for the forest.
Any help would be greatly appreciated.I have a running total field in the details already, giving me a total for each record in the group. What I need now is a total for the group. I tried putting the formula for the group running total in the details like you suggested but it returned '0'. I have now put the formula for the group running total in GF1 and it is returning the sum of the last record out of each subreport. (I hope that makes sense!!) At least I have a figure there now, just not the right one.
Any help? -
Hello All,
I have written manual running total formula:
Reset formula in group header:
whileprintingrecords;
numbervar sol:=0;
Evaluation formula in detail section
whileprintingrecords;
numbervar sol;
if Field_Name1 <> previous(Field_Name1) then
sol:= sol+ Amount;
Display formula in group footer;
whileprintingrecords;
numbervar sol;
But the total doesn't seem to match, can someone help me!
Thanks!
SonaliHi Sonali,
For Ex:
1) If the group is on County> U, and country has 40 detailed records.
2) The Option " Repeat group header on each page is checked" and a reset formula is placed in the
group header.
3) In one page take for example 25 detail records are printed the evaluation formula will evaluate for 25
records. And in teh next page again the group header will be printed. This causes the reset formula
to print again where the total becomes zero again. And the remaining 15 records will be added and
the group footer will display that total.
Regards,
Vinay -
Financial Reporting Studio - Running Total
I am trying to build a waterfall / step chart in Financial Reporting Studio to visualize large movements between prior year and current year profit by profit type. For it, i require a 'running total' of profit type movement. I burst the profit type dimension out on row 2 and i want to keep a running total formula calculation
e.g.
Last Year
This Year
Movement
Total Profit
[Profit Type].Level1 drilldown
Total Profit
I want to keep a running total of the movement in Row 2. How can i do this?Insert Formula Row and give it formula.
-
How do I use a running total within a selection formula?
I am developing a report within Crystal Reports 2008. My goal is to identify any accounts that have zero usage for at least six months in this current year. I have account number, meter size, read date, usage, and a running total/subtotal by account.
Here is what the data looks like in the report
ACCTNO METER SIZE READ DATE/TIME READ_USAGE Counter
001022-05
001022-05 2.00 9/28/2009 9:42:00 AM 0.00 1
1
001110-09
001110-09 2.00 3/2/2009 9:54:13 AM 0.00 1
001110-09 2.00 3/26/2009 1:32:28 PM 0.00 1
001110-09 2.00 4/27/2009 11:02:11 AM 0.00 1
001110-09 2.00 5/27/2009 1:13:53 PM 0.00 1
001110-09 2.00 6/19/2009 11:41:20 AM 0.00 1
001110-09 2.00 9/1/2009 8:13:25 AM 0.00 1
6
My report shows all accounts that have zero usage. I want to filter the report to only show the accounts that have at least six zero usage reads. I thought I could add a running total, sum it, and filter the data by using the selection formulas. Unfortunately I keep getting an error message saying "this field cannot be used becuase it is being evaluated later." Any help would be appreciated. This is the first report I have created using crystal.
Edited by: smwdrw2 on Oct 28, 2009 4:29 PMYou could Conditionally suppress the account numbers where your running total is less than 6
You will probably have to put your account number summaries in the group footer, instead of the header.
Then:
go to the section expert, click on the group footer for the account number, on the right, next to the word "Suppress" click on the box that says "X-2". In the formula put
IF<6 then True
Save and close
The only way this would not work for you is if you have some sort of grand total that you don't want to include the other groups in.
Maybe you are looking for
-
Where to Find the IVR Integration Interface Spec/APIs
We're developing a IVR client to talk to a PG and I'm having trouble finding documentation, libraries & sample code. We do have a older document 'ICM VRU interface specification 3.0c' and two include files but our developer is coming up short and nee
-
When I go to the Information section on my Zen Touch, it tells me the "Version" is 2.. When I press the tiny restart hole and press play to go the options like Reboot, Format All etc, it says "Creative Zen Touch v. 0.0.0". Is there an issue there? Al
-
Distortion with sound when viewing burned movie from idvd
I created a movie in iMovie that included tracks from iTunes and exported it to create the dvd in iDVD. When viewing it in iMovie, it sounds great. When I exported and viewed the movie in iDVD, it sounds great. But after I burn the dvd and view it on
-
How do I make it so that emails i delete off z10 do not delete off the email server
I cant seem to find away to stop it from deleting the emails or sent messages off of my server for all my email accounts.
-
XML container only partially updated in replication environment
I have a problem with adding new replicas to a replication group. The situation is the following: At startup the replication group only consists of the master database which has one container file containing 5000 documents. Then when I connect a new