Totalling a calculated field in end of report
Hi I have a formula field (F087/F050) in the report Repetitive Area0 and I want to total the results of these line by line amounts in the 'End of Report'
Please can someone explain how to compose the field I need in the End of Report
Thanks
Dom
Hi Dom,
You may use ColSum(FXXX) to get the total in the 'End of Report'.
Thanks,
Gordon
Similar Messages
-
In a page-detail table report, there are several numeric fields which must be totalled at the end of the report.
Some of the fields are calculated ones, i.e. a dollar amount multiplied by a conversion rate.
The total of the calculated fields are always blank whether I run the report in DESKTOP or I run the report in PLUS.
Any suggestions?
Thank you.
LeahHI,
Two things you should try:
a) put a to_number(nvl(field,0)) on the calculation
b) Try cell sum instead of regular sum.
Hope it will help you solve the problem -
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. -
Use calculated field(s) in other report
Hi everyone,
Is there a way to use a calculated field by itself in another report? I don't want to insert a sub report because it takes up too much space.
I just need to use few fields in other calculations in the new report.
Thank youThe only way I can think of doing this without subreports is to save the values in a database somewhere. In order to do this, the values would have to be calculated in the report's SQL Command data source. (I'm guessin' that's probably not what you're looking for, but using subreports is the only other way I can think of...)
HTH,
Carl -
In ALV grid report, totals of columns display at end of report
Hi.....!
In ALV report i want to display grand totals in end of list and also i want to output display ALV report in page by pageHi,
this the code i am sending it may help you.
DATA : wa_sort TYPE slis_sortinfo_alv.
DATA : it_sort TYPE slis_t_sortinfo_alv. " for sorting
PERFORM sub_total USING '<field based on wich you want sort(say key field>>'.
FORM sub_total USING value(p_sortfld) .
wa_sort-fieldname = p_sortfld.
wa_sort-subtot = 'X'.
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort
and then is main function module for display grid or list.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = wa_pgm
i_callback_top_of_page
='TOP_OF_PAGE'
i_grid_title = text-016
it_fieldcat = it_fieldcat
<b> it_sort = it_sort</b>
i_default = 'X'
i_save = 'A'
TABLES
t_outtab = it_final. -
Totals of calculated field w/ PL/SQL function
I have a worksheet with a numeric field that is calculated using
a registered PL/SQL function. When I add totals to the sheet, no
total appears for this column. Is this a known issue, or is
there something else going on?
Thanks,
CharlesI have the same problem. I used to work with Discoverer 4 and all the totals were there, but after the upgrade to 9.0.4 the totals for the calculated items that are based on stored procedures are gone. It has something to do with the procedures because the calculated items that do not call procedures do have the totals.
What is meant by the default setting of "Data point"? I cannot find anything like it in the administrator..... -
SORTING FOR THE CALCULATION FIELD IN CROSS TAB REPORT
LIST_G_AUCTION_TITLE>
<G_AUCTION_TITLE>
<BID_NUMBER>5002</BID_NUMBER>
<AUCTION_TITLE>E2E-01 Construction RFQ</AUCTION_TITLE>
<ITEM_NUMBER>C2631</ITEM_NUMBER>
<ITEM_DESCRIPTION>4G000,000,0STRUC,X,SPECIAL STRUCTURE</ITEM_DESCRIPTION>
<ESTIMATED_QTY>1</ESTIMATED_QTY>
<UNIT>LS</UNIT>
<QUOTE_PRICE>400</QUOTE_PRICE>
<ESTIMATED_QUOTE_PRICE>400</ESTIMATED_QUOTE_PRICE>
<SUPPLIER>X - L CONTRACTING</SUPPLIER>
my xml data is in this format, i created a cross tab report for ITEM_DESCRIPTION as row and SUPPLIER as column and calculated a sum(ESTIMATED_QUOTE_PRICE)
for all the ITEM_DESCRIPTION for every SUPPLIER in templete . now i need to sort the data by sum(ESTIMATED_QUOTE_PRICE) from lowest to higest from left to right , that is supplier with lowest sum(ESTIMATED_QUOTE_PRICE) should display first from left to right.
can any one help thanks in advance.thank you tim , for asking i got the solution. it is actually in template builder i was asking about. xml template builder
-
Calculation fields(column) In crystal report
Hi Experts
I have created a new report gainst A/R Invoice. Which contains DocNum, Docdate Card Name, DocTotal and Paidsum. Now I want derive balance and I want to put condtion formatting for those balance columns.
Can anyone help me How to calculate Doctotal-Paidsum to Balance column and to highlight the balance column which is more than sixty days amounts.
Waiting for ur replies.
By
Kalaiyou need to create a formula field to do this and then just drag and drop it into the report like any other column.
formula should be along these lines
{OINV.DocTotal}-{OINV.Paidsum}
as for the highlighting, just go to the designer, right click on the field you want to highlight and go to highlighting expert and follow the wizard from there to create a condition of when highlighting should occur. if your field is not available in the "Value Of" just build the field yourself as a Formula field and you will then be able to select that from the "Value Of" list.
hope it helps... -
Recalculating fields in an updateable report when a page item changes
Hi,
On the one page I have a header section where the user enters the total number of items (eg. 50).
I then have an updateable report on the same page where one of the columns is '% of the total items' and the last column of the table is calculated using javascript ('% of the total items' * 'total number of items').
eg. the page could look like this :
Total Number of Items : 200
Item Type % of Total Items Calculated Field
Toys 25% 50
Clothes 75% 150
When the value of the 'Total Number of Items' field is changed, I need to recalculate all the values for the last column.
I've tried to do this using javascript based on what I could find on the forum, but when I change the value in the header section, the last column of all the table rows are not being calculated.
Any assistance you could provide would be greatly appreciated.
I have an onchange trigger on the total number of items field
onChange="ReCalcProds()";
and the javascript function looks as follows :
function ReCalcProds()
var answer;
var amount1;
var amount2;
var tds = document.getElementsByTagName('td');
for (var k=0; k<tds.length; k++) {
if (tds[k].headers=="ACTIVITY_CODE") {
var inputObjs= tds[k].getElementsByTagName('input');
if(inputObjs.length>0) {
for (var j=0;document.inputObjs.length; j++) {
amount1 = parseFloat(document.getElementById('P9_TOTAL_PRODUCTIONS').value);
amount2 = parseFloat(document.getElementById('f08_'+j).value);
if (isNaN(amount1)){amount1 = 0};
if (isNaN(amount2)){amount2 = 0};
answer = amount1 * (amount2/100);
document.getElementById('f11_'+j).value = answer;
Many Thanks.anonymous,
Check out another thread that had a similar topic. It may help you work through your issue.
Re: Tabular Form - Dynamic Default Value
Todd -
Pending Value Field. In SO reports
Hy All Experts.
Please give me Details of Pending Order Value & Total Order Value Field for Sales Order Reports.
I used following Tables in Reports.
TABLES: VBEP , VBAP , VBPA , VBKD , VBAK , LIKP , LIPS , VBUP , KNA1.
Thnaks in Advance.
Bhavesh Panchal.hi, hope this code will help u.
MOVE-CORRESPONDING it_vbep to IT_VBEPVB.
append it_VBEPVB.
ALL FUNCTION 'RV_SCHEDULE_CHECK_DELIVERIES'
EXPORTING
fbeleg = it_vbap-vbeln
fposnr = it_vbap-Posnr
VERRECHNUNG = ' '
S073_ALT = ' '
F_NO_SORT = ' '
tables
fvbfa = it_vbfa
fvbup = it_vbup
fxvbep = it_VBEPVB
VBLB =
fvbap = it_VBAPVB
EXCEPTIONS
FEHLER_BEI_LESEN_FVBUP = 1
FEHLER_BEI_LESEN_FXVBEP = 2
OTHERS = 3
LOOP AT it_VBEPVB WHERE POSNR = IT_VBAP-POSNR.
IT_FINAL-KWMENG_d = IT_FINAL-KWMENG_d + it_VBEPVB-VSMNG. " COMPUTE DELIVERY QTY
IT_FINAL-KWMENG_p = IT_FINAL-KWMENG - IT_FINAL-KWMENG_d. "COMPUTE pENDING QTY
in this way u will get pending order quantity.
multiply this quantity with ur list amout which u will get it from konv-KSCHL = ZLSP .
multiply pending quantiy with konv-kwert where kschl = 'ZLSP' -
Sum calculated field in report
Hi, I have a report that groups by employee then by machine. In this report I sum several fields, but need to sum a calculated field and can't figure it out. This is the calculation:
<?( QTY_MOVED) div ( TIME +.001 ) div ( INVERSE + .001)?>
This is a total field using a field that works fine.
<?sum(current-group()/QTY_REJ)?>
How do I incorporate the calculation in the <?sum(current-group()/.............I get errors if I just put in the calculation above.
thanks!Thank you for your help. After taking your advice and getting it to work by messing around with the brackets, management has changed their mind on the calc. Now they want me to use this calculation:
SELECT EMPLOYEE, SUM(QTY_MOVED), SUM(QTY_REJ), SUM(TIME), (nvl([b]sum(QTY_MOVED),0)/nvl(sum(TIME),0))/nvl(sum(INVERSE),0) eff ,'DIRECT'
FROM VW_TIMETRACK
WHERE START_DATE >= :BEGIN
AND START_DATE <= :END
AND WORK_ORDER <> ' '
GROUP BY EMPLOYEE
to get the average. Now the weird thing is, I can get the value in toad, and I can get it to output in raw xml data, but when I try to add the eff field right next to the sum(time) field in the word form, nothing shows up. Absolutely no data. But it is in the xml. I'm using <?sum(current-group()/EFF)?> , just like I am for <?sum(current-group()/TIME)?> . I've made it text, numeric, decimal. Nothing is coming out. -
Data missing in Crosstab report with calculated field via case when
I use the Oracle 10g discoverer. When I create a crosstab report with a calculate field via function case when and put it as datapoint, some of the data is not showing. I tried to not use the case when function for the calculate field, then all the data show.
I really do not the reason. Could anybody help me out with many thanks?Let me explain more.
I have the original data below.
Work order, Team, Hours_worked, date
800001, S1, 5, 2012/01/01
800001, S1, 15, 2012/01/10
800001, S2, 4, 2012/01/04
800002, S1, 3, 2012/01/15
There are multipul records for the same work order, team on the same day or different.
Finally I want to set the start date and end date as the parameter to create a crosstab report format like
start date>=2012/01/01 and close date<=2012/01/05
Team
Total hours total hours within the range
Work order S1 S2 ... S1 S2 ...
800001 20 4 5 4
800002 3 0 0 0
in order to do it, I create two parameters independently start date and close date. Then I create a calculate field hours_worked_withinrange via
Case when date>=:start date and date<=:end date then Hours_worked else 0 end
This calculated field is correct in the tabular format report in discoverer desktop. But when I duplicate the list as crosstab. Some data is missing in crosstab data point.
I checked once I change the calculate field defination not use case when. (For example, C1=hours_worked*2). Then everything runs correct. -
Total using SUM not working on Account field on Lead History report
Hi,
I have a report based on Lead History on which I need to use the SUM of a field that is under the Account.Custom Number/Integer. This basically is a report of leads along with some fields from the account the lead is associated with. The SUM on that field works fine when I try it on another report off the Account History object but does not work when used on the report off the Lead History. It just shows the value of the field for that record instead of the total of the field for all the records displayed on the report. I am guessing that the issue has to do with the query going off the Lead-Account relationship because of which it treats each relationship as one resultset and totals the field values for just that relationship.
Any ideas on how to accomplish this would help very much. Can a field on one report be referred from another to achieve this?
Thanks in advance for your help!
Regards,
MadhukarHi again
Just checked a similar report test I did a while ago, and my query is:
SELECT c001 MyText, TO_NUMBER(c002) MyNumber
FROM HTMLDB_COLLECTIONS
WHERE COLLECTION_NAME = 'ATD'
So, you should use TO_NUMBER(c002)
Andy -
Calculated field in a Report Template
Hi,
I am trying to create a calculated field based on other calculations made in placeholder fields on a report template.
If I have the following 2 fields:
e.g. A = (1+2), B = (2*3)
what is the best way to get C = A div B rather than having to list out all the calculations (i.e. (1+2) / (2*3)
How can you set these first 2 fields as variables into the calculation?
Thanks
SteveFor variables read this:
http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12187/T421739T481157.htm#4535390
Set x:=5
<?xdoxslt:set_variable($_XDOCTX, 'x', 5)?>
Get value of 'x'
<?xdoxslt:get_variable($_XDOCTX, 'x')?>
Perform calculation on x, like x:=x+8
<?xdoxslt:set_variable($_XDOCTX, 'x', xdoxslt:get_variable($_XDOCTX, 'x' + 8)?>
cheers
Jorge -
Calculated Field to get Total Number of Records does not work
Hi,
For some reason, calculated fields aren't working in my business rule.
What I did:
In deficiency criteria, I added the calculated field "Total Val".
In conditions and calculations I chose "Grouping/Aggregation".
For Select Group Fields, I chose "Plant and Material Number".
For Aggregation Method, I chose "Count".
Result when "Apply Rule" is used:
The filtered records are still shown. The "Field Names" (names within the table such as MATNR instead of material number) are shown instead of the field labels.
I'm trying to determine the cause of this issue and how to resolve it. Does anyone have a suggestion of what it is and what can be done?Hi Arif,
Thank you for the response.
Is there a way we can further pin down the ABAP problem that is being experienced?
Best Regards,
Raphael
Maybe you are looking for
-
Hello SAP Scholars, When I try to post an invoice in MIRO, some amount is hitting BSX (stock account). Tax code I1 (4%) has been given in PO so logically there should be 3 accounts: 1) Reconciliation account 2) GR/IR account 3) Tax account but when I
-
HELP!!! Can't open .pdf file!
I have been sent a .pdf file which I am normally able to open but this file that was sent to me keeps sending me to Adobe's download page for a reader. I downloaded it thinking it was some kind of update and then it asked me to set up an account whic
-
Master table unknown child tables
Hi there! Suppose there is a master table having unknown child tables And i simply want to delete all the records of master as well as child's. Kind Regards! null
-
Sql loader control file path........
Hello all, I am running the below query through sql loader from client machine..... saved the below query in loader.ctl file, which I kept in "D:\loader.ctl" path.... options (skip=1) load data infile 'D:\flat.txt' into table GL_INTERFACE fields term
-
Hi, I;m displaying my ALV using SALV classes.But problem is that when i download it in PDF then traffic lights are not getting displayed. How can we show traffic lights in PDF for an ALV ? Thanks & Regards, Vivek Gaur