Running Total vs Numbervar
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,
Jen
Hi 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.
Similar Messages
-
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 -
Need to sum hh:mm:ss in crystal report using Running Total Fields
Hello,
I am new to .Net and crystal reports so please go easy on me.
I am trying to develop a crystal report using Visual Basic .NET. I have a column which displays the "Inbound Time" in "hh:mm:ss" format. I have to sum the total inbound time and display it.
I tried using the Running Total and i am not successful.
Here is the code which I am using in the Running total
WhilePrintingRecords;
if isNumeric({Report3;1.TotalInboundTime}) then
{Report3;1.TotalInboundTime}
else
CStr ({Report3;1.TotalInboundTime});
NumberVar array test2 := [ToNumber(left(CStr({Report3;1.TotalInboundTime}),2)),ToNumber(mid(Cstr({Report3;1.TotalInboundTime}),4,2)),ToNumber(right(Cstr({Report3;1.TotalInboundTime}),2))];
StringVar test1 := CStr( (ToNumber(test2[1])3600)+(ToNumber(test2[2])60)+(ToNumber(test2[3])));
InboundTime is the time field which is in "hh:mm:ss" format.Hello Bharathi,
There are a couple of KBs about this. I haven't tested them myself, but you could give them a try:
[How sum multiple time fields in Crystal Reports|http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2008378]
[Creating a running total to show the difference between two datetime fields |http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2010261]
[Totalling time values that are stored as numbers in the database|http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2005576]
Cheers,
Fritz -
Running Total & Distinct Count Query
Crystal 10.0.0.533 CR Professional
Hope you can assist.
I have a report listing deals signed, each deal has a corresponding category i.e. industry type, Accountant, Chiropractor, Financial Services, etc.
I am undertaking a Distinct Count on these categories so that in the group footer it is showing number of different categories signed in a period (the report is grouped into different date periods). This is working OK.
However, I need to EXCLUDE the category from this distinct count if the deal value is zero.
I have tried using a formula to show a blank field if the value is zero, however it appears to be distinctly counting the blank as a category?
Any assistance would be much appreciated.
TracyDeffinetly it will be less than what you expect for grand total. It is because when you are calculating distinct count for each group suppose
Group A has categories A,B,C,D-->distinct count (4)
Group B has C,D,E,F-->distinct count (4)
but while calculating grand total then the distinct count will be
A,B,C,D,E,F --> grand total (6) but not (8).
In this case you need to use mannual running total like this
whileprintingrecords;
numbervar i;
i:=i+{running total};
place this in group footer and create another fomula like this
whileprintingrecords;
numbervar i;
place this in report footer to get the correct grand total.
Regards,
Raghavendra -
Crystal reports - charting a variable to simulate a running total
I have 2 sets of data as below :
units
costs
What I am trying to do is generate a chart that for each month, reports the result of the formula
sum of costs to date / sum of units to date
Ideally, I would create 2 running totals
RT costs
RT units
then a formula avg. cost to date = RT costs/ RT units
and then for each month (x axis of the chart) plot avg/ cost to date
BUT - crystal won't plot a data set based on running totals.
So, I created a field with a psudo running total
i.e.
whileprintingrecords;
numbervar unitsum;
unitsum:=unitsum+units
and similar for the costs. Variable called costsum.
Then a variable field
whileprintingrecords;
numbervar results;
results:=costsum/unitsum
So I though I could then plot the field with the variable results in it in the chart. But no, I cannot see the field name in the data select list.
Please advise how I can create my chart.
Thanks
Edited by: newbyr on Jul 7, 2010 12:20 PMWith the best will in the world, I realise that charting does not like running totals, What I am looking for is a workaround, or clever way of circumventing the problem.
Before posting I did extensively search the forum and saw the link that DebiHerbert has suggested, and it is of no help at all.
Thanks
Edited by: newbyr on Jul 9, 2010 2:40 PM -
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. -
Crystal report running total balance
Hi guys, please help me.
im creating a report using crystal report that display running balance from subreport.
i do have subreport and add it to main report but i need it real time changing.
for example
TRANSACTION TYPE QTY_IN QTY_OUT RUNNING BALANCE
RECEIVED 1 0 1
RECEIVED 2 0 3
SHIP OUT 0 1 2
SHIP OUT 0 1 1
RECEIVED 1 0 2
diagram shows the needed output of the report. please help. thankshi sir abhilash, i know you know how to fix this, maybe i need to provide some more information about the report: here what i did:
created formula @QTY_IN where code is:
if {ITRN.TRANTYPE} = 'DP' then
{ITRN.QTY}
else
if{ITRN.TRANTYPE}='AJ' then
(if {ITRN.QTY} >=0 then {ITRN.QTY}) else
0
create formula @QTY_OUT
if{ITRN.TRANTYPE}='AJ' then
(if {ITRN.QTY} >=0 then 0 else
{ITRN.QTY}) else
if{ITRN.TRANTYPE}='WD' then
{ITRN.QTY}
else 0
create running total fields for @QTY_IN And @QTY_OUT
total_qty_in and total_qty_out
sum the fields and resets every change of group.
create a formula(running) based on your suggetion
create running_total_reset code is
WhilePrintingRecords;
numbervar rt := 0;
paste it to group header.
the output is
in out running
shipment 0 -4 146116
shipment 0 -1 146117
shipment 0 -4 146116
but it should be
in out running
shipment 0 -4 (-146118) 146114
shipment 0 -1 (-146114) 146113
shipment 0 -4 (-146113) 146109
so on so forth.
we can do this sir. thanks ^__^.
really appreciate your help. -
Running totals in crystal designer
Hi all!
I want to create a report with running total, that accumulate Balance value for each page.
Total accumulate should be reseted on each new page.
I have a query for report: SELECT CardCode, CardName, Balance FROM OCRD.
And i want a running total for field "Balance" (this total should be reseted on each new page).
In Crystal Designer I create new Running Total Field (in the PageFooter section).
In the Editing Running Total window I fill the following sections:
1) Summary section. Field to summarize: "Command.balance". Type of summary: "sum".
2) Evaluate section. On change of field: "command.cardcode"
3) Reset section. I want to choose PageNumber in the field "on change of field". But there is no any special field in the section "Available tables and fields"
How to reset the running total on each new page?
Thanks in advanceHi all!
The problem can be solved with report formulas. Probably this information will be useful to somebody.
So, we have the following task: need to calculate subtotals on each page.
Let's look at the solution.
On the first step, create Formula fields:
1) InitPageSum field has formula:
WhilePrintingRecords; NumberVar PageSum := 0;
2) CalcPageSum field has formula:
WhilePrintingRecords;
numberVar PageSum := PageSum + {Command.LineTotal}; // I use command to get field-values from //database
numberVar PageSum
3) PageBalance field has the following formula:
WhilePrintingRecords; numberVar PageSum
On the second step we place formula-fields in report sections.
1) Variables initialization.
Insert section in PageHeader area (lets name this section PHa). Drag formula InitPageSum into PHa for zeroing PageSum for each page. Then suppress the section PHa.
2) Increasing subtotal on page.
Create additional section in Details area (Dc). Drag CalcPageSum formula-field on this section (Dc). PageSum variable will be increasing in each line. Suppress the section Dc.
3) Display results.
a) Insert additional section in PageFooter area (let's name it PFa). Drag PageBalance formula-field into this section (PFa). The section PFa should be displayed on each page of the report, except the last page. The formula is:
if PageNumber <> TotalPageCount then true else false.
b) Insert additional section in ReportFooter area (let's name it RFa) and make this section the first section of the Report Footer area. Drag PageBalance formula-field into the section RFa. The section RFa should be displayed on the last page only. So, for the Suppress property of this section, create the formula:
if PageNumber = TotalPageCount then true else false
We make this adjustment (additional section in report footer area) because we need subtotals directly under the report (and not at the bottom of the page)
Best regards,
Katrine -
Cumulative Balance Running Total
Hello community,
i am doing a business partner Account balance report, i have already successfully fetch my data in to crystal reports as well as the running total for the cumulative balance, my problem is i have a duplicated rows in debit side, now how will i say to crystal reports (in Formula expression) that the 1st line if duplicated will the only one to be evaluated. for more detail please see image below
http://i264.photobucket.com/albums/ii184/abing430/CRDuplicatedRows.png
http://i264.photobucket.com/albums/ii184/abing430/CRDuplicatedRows-1.png
please help.
best regards,
Fidelhello sharonamt,
thanks for the response.
//Head
Shared NumberVar OB := {Command.Open Balance}
//Line
shared numbervar OB;
OB := OB + {BP_AccountBalance;1.Credit} - {BP_AccountBalance;1.Debit}
//Footer
Shared numbervar OB
i have this ff. formula the header is put in the page header, the line is put ing Group Footer section and the footer is put in report footer section. my group is grouped by Ref field w/c is unique in this report.
the duplicated rows is eliminated since i put my line formula in the group footer. but using the ff. formula's the report is ok, the results is fine on the first page only, because in the second page it will get the OB balance which is in the page header of the report., i dont needt to reset my running total.
thanks.
please help
best regards.
EDIT:
i have manage to figure out my problem... i just use this formula and it works.
whileprintingrecords;
if pagenumber = 1 then Shared NumberVar OB := {OpeningBalance.Open Balance}
else
0
since im having problem with reseting of the openingbalance, i had trap the page numvber and never reset the running total. this formula works for me as of now.
Fidel
Edited by: Avelino Fidel on Jan 24, 2011 2:46 PM -
Post Author: dbmngleaf
CA Forum: Formula
I'm using Crystal Report XI and I have a report where I need to supress data and show a running count for just the records that are showing on the report. My supression works fine but the running count isn't. I've seen that you can't use the built in running totals when you're supressing data and I seen that you can create 3 formulas to get this to work however it isn't working.
My formulas are:
total_init
WhilePrintingRecords;
numberVar overall_total:=0;
total_calc
WhilePrintingRecords;
numberVar overall_total;
overall_total:=overall_total+1;
total_disp
WhilePrintingRecords;
numberVar overall_total;
The formulas are totaling everything including the supressed records. How do I get it to count just the records that are displaying? Thanks for any help in advance.Post Author: yangster
CA Forum: Formula
you're almost therethe only thing you need to is change your evaluation formula, you don't have an if statement in there to tell it to ignore the records you don't want to countwhat you have right now is it will increment by 1 for every recordtotal_calc
WhilePrintingRecords;
numberVar overall_total;if not(whatever you are supressing on) thenoverall_total:=overall_total+1;so this will count every time the record is not supressed -
Manual Running Total vs Running Total
Morning all,
It is some what strange to me when I try to use a formula to calculate the total jobs and when I try to use Running total to count the same total jobs. Both answers in theory should be the same however they are not. I am wondering where am I going wrong in the manual formula.
If {despatch_summary.job_type}="FSV" then
if {despatch_summary.order_status}<>0 then
{despatch_summary.order_no}
else
0
The above code then gets DistinctCount ({@FSV})
The same method if I use by using Running Total it gives the correct number of jobs.
Running Total
field to summarize : despatch_summary.order_no
Summary Type: DistinctCount
Formula: {despatch_summary.job_type}="FSV" and {despatch_summary.order_status}<>0
Reset: none
The formula gives me 513 where as the same running total gives me 514
Where am I going wrong?
Strangely it is adding 1 to all of my manual running totals (1 is coming from canceled orders).
Many thanks
RegardsSastry I am adding this formula into the crosstab which is setup by Number of days. So on the column it is number of days and on the summarized field it is this formula.
I chose Group options and clicked on DistinctCount after adding the formula into the summarized field.
I have already tried the formula you have suggested however it doesn't seem to be affecting it.
Apart from that what I have just done is added the Running Totals to the Summarized field which is coming up correctly however now the problem is to get their percentages.
I have used the following code but it doesn't seem to be working.
Whileprintingrecords;
Numbervar g:=Currentfieldvalue;
Numbervar h:={@TotalJobs-CanceledJobs};
Numbervar i:=0;
i:=((g/h)*100);
Numbervar gTot:=gTot+i;
if gTot > 100 then "100.00%"
else
totext(gTot,2)+"%"
I know I am doing it wrong when it comes to percentages. I need to get the percentages off that Running Total (Grand Total).
Am not sure how to acheive that either.
Many thanks
Regards
Jehanzeb -
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 -
I want to put a running total as alphabets.
For Example
1. Question Title
A) Option 1
B) Option 2
C) Option 3
2. Question Title
A) Option 1
B) Option 2
C) Option 3
I got the running numbers for Question Title but i am not getting the A,B,... for Answers.
Have anyone done similar with Crystal Reports Running Total or any other different way?Hi Dharmesh,
Try this:
1) Group by Title
2) Create this formula and place it on the Group Header:
WhilePrintingRecords;
numbervar i := 64;
3) Create another formula and place this on the Details Section:
WhilePrintingRecords;
numbervar i;
i := i + 1;
if i <= 90 then
chrw(i);
-Abhilash -
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 Issue: How to calculate counts excluding suppressed records
Post Author: benny
CA Forum: Formula
Hello All:
I have a current report that gives the total counts of work requests. However, in my section expert, there are some records in the detail that are suppressed (if there isn't any backlog). The current running totals are counting all the records including the suppressed records. I think I need three formulas:1. Calculate the counts2. Calculate the counts excluding suppressed records3. Reseting the counts by group
May I ask if someone can give me an example of what I should do?
Thanks so much!
BennyPost Author: benny
CA Forum: Formula
Bettername,
Actually, I should have been more specific. This report is actually a PM backlog report. It displays all the work requests (PM) issued including the backlogged. There are 9 columns (including one called Backlog) for the different counts of the pm's based from the status codes (Issued, Material on Order, Completed, Cancelled, etc) of the work requests. The detail records of worke requests are grouped by shop and PM end date. The running totals are calculated at the pm date group level (group footer#2). Then based from those at the shop group level (group footer#1) there is a grand total of counts of the running totals. The detail records and pm end date group header (group header #2) are suppressed.
Now the foremen would like the report to just display all the backlogged PMs. Using the section expert, I suppressed all the PM issued that have no back log ({@ backlog = 0}) and just display the back logged pm's. This is where I run into the running total issue.
This is very involved report and I will use the column PM Issued as an example. I can still use the same logic as you suggested?
1. declaration formula:
whileprintingrecords;numbervar pmissued := 0;
2. Suppression formula that uses the variable:
whileprintingrecords;
numbervar pmissued;
if ({@ backlog = 0}) then pmissued:= pmissed else pmissued:=pmissuedr+1
3. Display formula:whileprintingrecords;
numbervar pmissued;
If this is the right track, then I can use the same example for the other columns.
Thanks so much.
Benny
Maybe you are looking for
-
i bought a locked at&t phone.... i sent it to be unlocked... got back a dead iphone 5s... plugged the charger in the wall, it gives me a black screen then the white screen with the apple logo, then repeat.... i tried the dfu thing and now the phone i
-
I have an iphone 4s, and I've been trying to update my iphone to IOS8 and it keeps saying there is not data storage available, they need 5.8, and I have deleted everything and have more than enough for the update, why is it not working?? what can I d
-
Which is better ? Toplink Java objects or Toplink Entities ?
Hi We are planing to use Toplink JPA that comes with JDeveloper 11g preview release I have a question here! I would like to get clarified which is better to use : 1. Toplink Java Objects from Tables , 2.Toplink Entities from Tables Could you suggest
-
Table from which all requests details report can be extracted
Hi to all I would like to know from which table we can have a look on all request details which are in quality but not in production i want move prd data to quality if i does this all request are getting vanish in quality Regards
-
Not picking the stock for the delivery
Dear friends, Though the stock is available, it is not getting picked for the delivery. Can you guide me what are the things I should check to solve the issue. With regards, Atul