Running total above Group
Hey,
I may be having a brain freeze. I need to print a running total (max) above the detail lines of a report. Since the running total is not known until after the detail lines, is there a way to do this? I'm stuck and frustrated. Thanks,
Jim
I'm starting to think I am going about this in the wrong way. My report has a field named 'tolerance' which is on every other record but does not appear in the report detail. It is the same value for every record in the group. I need to capture the value and display it in the group header. I was attempting to do a max() running total, and the field looked fine in the group footer, but when I copied it to the group header to changed to blank.
I think there must be a simpler way to do this, but I don't know what it is. Thanks for your help,
Jim
Similar Messages
-
DISPLAY RUNNING TOTAL IN GROUP HEADER
Post Author: sharonmtowler
CA Forum: Formula
I know there is a way to do this, just forgot how. i am in version 8.5. i have a manual running total which calculates order qty for the entire sales order.i (dont like using the rt wizard-buggy)
the knowledge base says to use a cross tab, but there hit or miss also.
does anyone know how to show the display formula for a manual runnning total in the group header instead of group footer?Post Author: pandabear
CA Forum: Formula
Hi Sharon,
I wanted to try this before I sent it to you, but my Crystal is down because (blah, blah, long story here....yawn....).
I think I understand. You want to show the "Total" for each group, in the group header instead of the group footer?
My experience is that Crystal works from the top down (read: limiting), so I need a work around to do this.
1 - Do the calculation in the query...sum by group, filter with a "Case" statement, etc. If there's a reason you can't do that then
2 - (and this is what I wanted to try first) see if you can group on the same field twice.
Group 1 - Test.field
Group 2 - Test.field (same field)
If you can,
then just carry the total from the group footer of the previous group (same field) above you, and bring it down
(shared var ?) to the group below.
My 2 cents is up.
Hope this helps,
The Panda -
Running total in group header doesn't display when it's at page bottom
Post Author: Charles Denight
CA Forum: Formula
Hi, Using v.9 of Crystal Reports I've created some running totals using a cross-tab workaround to get the running totals into the group headers, but when the group header falls at the bottom of the page then the running total doesn't show up.Would appreciate knowing why and how to fix this.Replacing an item that is malfunctioning because of a manufacturing error is the bare minimum I would expect from customer service for any electronics item.
The thing Apple does extremely well is their flat fee policy for repairs on their computers.
I managed to break my MacBook pretty seriously (logic board needed to be replaced) and I'm sure it cost them more to repair the unit than the $328 they charged me.
I probably would have been angry if it was something minor, but I'm guessing that most repairs to screens/motherboards/etc cost more than their flat fees. -
Post Author: bahamaER
CA Forum: Crystal Reports
Hello, I have been reviewing threads for running totals and would like some assistance on creating a running total for a group with a condition that will display in the group header, the running total should also reset for each group. Is this possible?
I know that there are some constraints such as the variable being reset to 0 in the header for each group as well as the group records have not been rendered when the header formulas are being assessed. I have been able to accomplish the task of running totals with conditions for groups using a running total field and also 3 separate formulas placed in the group header, detail and footer. The display is only correct in the group footer; my goal is to have the footer formula in the group header. Any ideas? I am currently using CR 8.5 but will be upgrading to CR 2008.
ThankyouHi,
If you are trying to calculate Total and display it in Group Header for field value placed in Detail, then you will get incorrect/no value for total, as Crystal Reports prints/processes the report line by line and it will not be able to process the Total for field in Detail section in Group Header.
Its is by Design.
For a workaround:
- Insert the same probematic report (Say A.rpt) as a Subreport in Group Header of this report(Say A.rpt).(Say in GroupHeader A1) and link the Main Report to the
- Insert Section Below (Say GroupHeader A2)
- Calculate Total in Section Group Header A2)
This workaround will reduce the Performance of the report as Subreport will be proceed for each Group Value.
Regards,
Kiran -
Post Author: cjsmile2106
CA Forum: Formula
Hello Everyone
I have a weird problem. I have a report that has three groups. In each group I have manual running totals. I would like to take a manual running total that I have in Group 2 and subtract it from my Group 3 manual running total. However when I attempt this for some odd reason by manual running total from Group 2 is not subracting that same number. For example:
Group3
5 - 7 = -210 - 7 = 315 - 7 = 820 -7 13
Group 2
-7
Its not doing that however, it seems to be subracting some random numbers instead of the Group 2 total. Thank you for your assistance!Post Author: sharonmtowler
CA Forum: Formula
make sure you do not have repeat group header or keep group together checked, causing weird mrt. make sure the variable name is not used in another variable name. you may need to place the formula that is subtracting the display formulas below the other to get an accurate set, and use whileprintingrecords -
Post Author: llcoolt
CA Forum: Formula
I have a couple of group running totals:
TotalItems
TotalCompleteAtExp
I need to create a formula that finds the percentage of the two. Any help? Would this be in a running total?Post Author: llcoolt
CA Forum: Formula
but it's calculated at a group level, not as a percentage for the whole report.
The running totals were grouped by vendors. The percentage I was looking for was also grouped by vendor, not a percentage of ALL service orders and the vendors they were assigned to, but percentages run per vendor based on those completed by vendor. -
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 -
Oracle report running total Resetting balance on next group
Dear All,
I am developing report on Oracle R12 fixed Assets, I have to calculate the running total for each asset.
In brief
Asset 1
cost Deprciation Adjusted Cost
50 - 2 48
48 -5 45
45 - 4 41
I achieved that by using
if :p_val is null then
:result := nvl(:cost,0)-nvl(:depriciation,0);
:P_val :='5';
return :result;
else
:result := nvl(:result,0)-nvl(:depriciation,0) ;
return :result;
end if;
working fine
But problem is when the next asset start on same report
Asset 2
cost Deprciation Adjusted Cost
100 5 36
it substracts the last total (running total of previous asset with depriciation which was 41 in this example).
Oracle Champs pl advice me how to solve this.
I really dont got any idea how to solve this.
thanksDear,
Thanks for your reply , in your reply what you said I tried this but in pl/sql I am not actually achieving the result. The balance is not resetting at next group if you give one accurate line it would be really helpfull.
thanks -
Running Total does not reset when group changes
I have a manual running total for group3 that does not reset for group2
Group2 Header (Order Status 3=Open,4=Closed)
WhilePrintingRecords;
currencyVar WIP=0;
Group3 footer (Order Number)
WhilePrintingRecords;
currencyVar WIP;
WIP := WIP + {@NETWIP}
Group2 footer
WhilePrintingRecords;
currencyVar WIP;
There are no Repeat Group header on any of the groups
Will add Group1 total when this part works.I am not sure if you made a typo when making your post but you are missing a colon when resetting your variable
change from this
currencyVar WIP=0;
to this
currencyVar WIP:=0; -
Running total / Summary - 3 groups
Dear All,
I am facing an problem in Summary / Running Total in my crystal Report. I have 3 groups as under :
1) Document Series
2) Territory
3) Transaction Details which includes Document Total
Now Example my document series is Projects and Territory is Japan and India and in Transaction Details which is document total has values of 100, 200, 300,500 for Japan and 300,400 for India
Now I am not able to bring a summary / running total of Japan which should be 1100 and for India 700 respectively.
I want summary for Document Series Also means for Projects it should show the total of 1100 + 700 = 1800
and a grand total of 1800 if its only projects series and if other series it should show projects + handling series.
Pleas help as I have tried but not been successful.
regards,
kamleshfor Territory Running total
1. Field to summarize : documentTotal
2. Evaluate : for each record
3. Reset: on change of field -> Territory
Place it in Territory Group footer
for Document Series Total
1. Field to summarize : documentTotal
2. Evaluate : for each record
3. Reset: documentseries
Place it in Document Series group Footer
for Grand Total
1. Field to summarize : documentTotal
2. Evaluate : for each record
3. Reset: never
Place it in Report Footer
HTH,
Jyothi -
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 -
Sort Group Based on Running Total
Is there a way to sort the group based on the running total of the group?
Thanks!
DeannaI think it is not possible to sort the group based on a running total. You can sort based on a summary field using group sort expert. Since the running total executes whileprintingrecords we cannot sort based on running totals.
Regards,
Raghavendra -
SSRS 2008 Running Totals - How are they created at the grouping by level
I am trying to create the running total column(the right column) month-to-date, and I am new to SSRS. Is this possible to do on the SSRS-side, or, will I need to do this in the SQL stored procedure that SSRS is calling?
Number Enrolled
Number Enrolled
Enroll Date
Enroll Type
Enroll Group
Enroll Offer
Enroll Source
DAILY
MTD (Running Total)
10/1/2013
Online
Internet
1234
ABC
1
1
10/2/2013
Online
Internet
1234
ABC
0
1
10/3/2013
Online
Internet
1234
ABC
6
7
10/1/2013
Online
Internet
1234
DEF
4
4
10/2/2013
Online
Internet
1234
DEF
6
10
10/3/2013
Online
Internet
1234
DEF
0
10Hi Mitch1743,
According to your description, you want to get the total number on each row. Right?
In Reporting Service, we can use RunningValue function to do aggregation calculating for each row. Put expression: =RunningValue(Fields!Sales.Value,sum,”Group2”) into the last column (Group2 between “” is the parent group of detail rows).
We have tested it in our local environment , the table and result will be looks like below:
Reference:
RunningValue Function (Report Builder and SSRS)
Understanding Groups (Report Builder and SSRS)
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
Running totals help required. Total PartNumber when in Date Order / Group.
I am trying to create a shortages list of our order book for all our customers orders outstanding. I want a running total of the orders which works until I group the orders in date order, not PartNumber order. It needs to be in date order so the users has a priority order for jobs. What is the best ways to do a running total of the quantity required where the PartNumbers match but keep it in date order.
Hi,
Welcome you post on the forum.
Do you need query for one selectable PartNumber or all PartNumbers?
Thanks,
Gordon -
Running total of calculated field in pivot
VERSION: ORACLE 11
TABLE:
create table chart_detail (
DIS NUMBER,
BLD_MO VARCHAR2(7),
BLD NUMBER(10),
RPLC NUMBER(10));DATA:
insert into chart_detail values (60,'2011-03',0,2);
insert into chart_detail values (150,'2011-04',10572,0);
insert into chart_detail values (120,'2011-04',26449,5);
insert into chart_detail values (30,'2011-04',0,1);
insert into chart_detail values (60,'2011-04',0,7);
insert into chart_detail values (90,'2011-04',0,9);
insert into chart_detail values (120,'2011-05',5714,0);
insert into chart_detail values (90,'2011-05',24557,1);
insert into chart_detail values (60,'2011-05',0,4);
insert into chart_detail values (30,'2011-05',0,0);
COMMIT;EXPECTED RESULTS:
2011-04 2011-05
DIS RPLC BLD TBLD IPTV RPLC BLD TBLD IPTV
30 1 0 37021 0.03 0 0 30271 0.00
60 7 0 37021 0.22 4 0 30271 0.13
90 9 0 37021 0.46 1 24557 30271 0.17
120 5 26449 37021 0.59 0 5714 5714 0.17
150 0 10572 10572 0.59 0
180 0 0
TOTAL 22 37021 5 30271 PROBLEM: I need to have a running total of IPTV like in the above example. I can get the IPTV for each DIS/bld_mo but I don't know how to get the running total of it. In the script below I just used an example where I tried summing the IPTV like was done for build. I know it can't be done that way because IPTV is a calculated field in the query but if I substitute "APR_IPTV" with the formula for IPTV I get an error that window functions aren't allowed here. I do not know a way around this. I commented out the bad piece of code.
PROBLEM SCRIPT:
WITH pivot_results AS
SELECT dis
, NVL (apr11_rep, 0) AS apr11_rep
, NVL (apr11_bld, 0) AS apr11_bld
, NVL ( SUM (apr11_bld)
OVER (ORDER BY dis DESC)
, 0
) AS apr11_tbld
, DECODE(NVL ( SUM (apr11_bld)
OVER (ORDER BY dis DESC)
, 0),0,0,ROUND(NVL(apr11_rep, 0)*1000/ NVL ( SUM (apr11_bld)
OVER (ORDER BY dis DESC)
, 0),2
)) AS apr11_iptv
, NVL ( SUM (apr11_iptv)
OVER (ORDER BY dis DESC)
, 0
) AS apr11_tiptv
, NVL (may11_rep, 0) AS may11_rep
, NVL (may11_bld, 0) AS may11_bld
, NVL ( SUM (may11_bld)
OVER (ORDER BY dis DESC)
, 0
) AS may11_tbld
, DECODE(NVL ( SUM (may11_bld)
OVER (ORDER BY dis DESC)
, 0),0,0,ROUND(NVL(may11_rep, 0)*1000/ NVL ( SUM (may11_bld)
OVER (ORDER BY dis DESC)
, 0),2
)) AS may11_iptv
, DECODE(NVL ( SUM (may11_bld)
OVER (ORDER BY dis DESC)
, 0),0,0,ROUND(NVL(may11_rep, 0)*1000/ NVL ( SUM (may11_bld)
OVER (ORDER BY dis DESC)
, 0),2
)) AS may11_tiptv
FROM chart_detail
PIVOT ( MAX (rplc) AS rep
, MAX (bld) AS bld
FOR bld_mo IN ( '2011-04' AS apr11
, '2011-05' AS may11
SELECT CASE
WHEN GROUPING (dis) = 0
THEN TO_CHAR (dis)
ELSE 'Total'
END AS dis
, SUM (apr11_rep) AS apr11_rep
, SUM (apr11_bld) AS apr11_bld
, SUM (apr11_tbld) AS apr11_tbld
, CASE
WHEN GROUPING (dis) = 0
THEN SUM (apr11_iptv)
END AS apr11_iptv
, SUM (apr11_tiptv) AS apr11_tiptv
, CASE
WHEN GROUPING (dis) = 0
THEN SUM (apr11_tpiptv)
END AS apr11_tiptv
, SUM (may11_rep) AS may11_rep
, SUM (may11_bld) AS may11_bld
, SUM (may11_tbld) AS may11_tbld
, CASE
WHEN GROUPING (dis) = 0
THEN SUM (may11_iptv)
END AS may11_iptv
FROM pivot_results
GROUP BY ROLLUP (dis)
ORDER BY pivot_results.dis
;Thank you,Hi,
So you know how to compute iptv for an individual row; the problem now is that you want to get a running total of iptv; is that it?
The problem there is that computing iptv requires an analytic function, and analytic functions can't be nested. To get the results of nesting f (g (x)), where f and g are analytic funtions, you have to compute g in a sub-query, and then use the results as the argument to f in a super-query.
Here's how to apply that to your situation:
WITH pivot_results AS
SELECT dis
-- April, 2011
, NVL (apr11_rep, 0) AS apr11_rep
, NVL (apr11_bld, 0) AS apr11_bld
, NVL ( SUM (apr11_bld)
OVER (ORDER BY dis DESC)
, 0
) AS apr11_tbld
, NVL ( 1000 * apr11_rep
/ NULLIF ( SUM (apr11_bld) OVER (ORDER BY dis DESC)
, 0
, 0
) AS apr11_iptv
-- May, 2011
, NVL (may11_rep, 0) AS may11_rep
, NVL (may11_bld, 0) AS may11_bld
, NVL ( SUM (may11_bld)
OVER (ORDER BY dis DESC)
, 0
) AS may11_tbld
, NVL ( 1000 * may11_rep
/ NULLIF ( SUM (may11_bld) OVER (ORDER BY dis DESC)
, 0
, 0
) AS may11_iptv
FROM chart_detail
PIVOT ( MAX (rplc) AS rep
, MAX (bld) AS bld
FOR bld_mo IN ( '2011-04' AS apr11
, '2011-05' AS may11
SELECT CASE
WHEN GROUPING (dis) = 0
THEN TO_CHAR (dis)
ELSE 'Total'
END AS dis
-- April 2011
, SUM (apr11_rep) AS apr11_rep
, SUM (apr11_bld) AS apr11_bld
, SUM (apr11_tbld) AS apr11_tbld
, CASE
WHEN GROUPING (dis) = 0
THEN ROUND ( SUM (SUM (apr11_iptv))
OVER (ORDER BY dis)
, 2
END AS apr11_iptv
-- May 2011
, SUM (may11_rep) AS may11_rep
, SUM (may11_bld) AS may11_bld
, SUM (may11_tbld) AS may11_tbld
, CASE
WHEN GROUPING (dis) = 0
THEN ROUND ( SUM (SUM (may11_iptv))
OVER (ORDER BY dis)
, 2
END AS may11_iptv
FROM pivot_results
GROUP BY ROLLUP (dis)
ORDER BY pivot_results.dis
;Output:
APR11 APR11 APR11 APR11 MAY11 MAY11 MAY11 MAY11
DIS _REP _BLD _TBLD _IPTV _REP _BLD _TBLD _IPTV
30 1 0 37021 .03 0 0 30271 .00
60 7 0 37021 .22 4 0 30271 .13
90 9 0 37021 .46 1 24557 30271 .17
120 5 26449 37021 .59 0 5714 5714 .17
150 0 10572 10572 .59 0 0 0 .17
Total 22 37021 158656 5 30271 96527As you can see, this is not quite what you wanted on the row where dis='150'. You asked for NULLS in the may11_rep, may11_bld and may11_iptv columns. You can get those results if you need them; just explain the rules that govern whether to display the values and when to display NULL.
The way you posted the sample data and results, and the quantity of sample data were all excellent; it really helped me find a solution. Thanks.
It would have also helped it you had explained how iptv is computed. Basically, iptv = 1000 * rep / tbld, right?
It looks like most of this code:
, DECODE(NVL ( SUM (may11_bld)
OVER (ORDER BY dis DESC)
, 0),0,0,ROUND(NVL(may11_rep, 0)*1000/ NVL ( SUM (may11_bld)
OVER (ORDER BY dis DESC)
, 0),2
)) AS may11_iptvwas a way of avoiding divide by 0 errors; it would have been helpful if you had explained that.
Maybe you are looking for
-
Dynamic From statement in select query and/or outer join not working
Dear Experts, I have a select query where the select columns are dynamic, the where condition is also dynamic. It is of the below format: Select (dynamic columns) INTO <wa> FROM a inner join b on af1 = bf1 inner join c on af2 = cf2...... WHERE (dynam
-
I have tried to print the front panel and the block diagram. The front panel is blank but I do get the block. What is the issue. Tried on another pc and both do not work. Dg
-
What Message type and Process Code to use for Purchase Order Change in 4.6C
I like to implement in SAP R/3 4.6C a scenario for Purchase Order Change, via inbound IDoc. I have been searching, but could not find what Message Type, Idoc Basic Type and Process Code to use. I can not imagine this functionality does not exist in 4
-
Error when clicking login server administration link
Hi I am using Portal 3.0.7 on NT. When I click the login server administration link in the services portlet under the administer tab I get the following error ORA-06510: PL/SQL: unhandled user-defined exception ORA-06512: at "PORTAL30_SSO.WWSSO_LS_PR
-
Installing Windows 7 on Satellite A300-1GC
I got nearley two years ago from Toshiba the dvd with windows 7+ all drivers for my notebook buit unfortunately i'm not at home and i decided to upgrade from Windows xp to Windows 7 so i have a few questions: 1)There is a software (by Toshiba) that i