To get sum of balance_due
hi all
i have this query with me
SELECT rac.customer_number, rac.customer_name,
su.LOCATION contract, SUBSTR (sa.NAME, 1, 2) bu,
ra.purchase_order_date sub_date,
ra.invoice_currency_code ccy,RA.PURCHASE_ORDER,ra.trx_number,
TRUNC (rad.gl_date) gl_date,
SUM
(npar_get_invoice_balance (ra.customer_trx_id,
'08-Sep-2011'
) balance_due
FROM ra_customer_trx_all ra,
ra_site_uses_all su,
ra_cust_trx_line_gl_dist_all rad,
ra_customers rac,
ra_cust_trx_types_all ty,
ra_salesreps_all sa
WHERE TRUNC (rad.gl_date) <= '08-Sep-2011'
AND ra.bill_to_customer_id = rac.customer_id
AND su.site_use_code = 'BILL_TO'
AND su.site_use_id = ra.bill_to_site_use_id
AND ty.cust_trx_type_id = ra.cust_trx_type_id
AND ty.TYPE = 'INV'
AND ty.org_id <> -3113
AND rad.customer_trx_id = ra.customer_trx_id
AND rad.account_class = 'REC'
AND rad.latest_rec_flag = 'Y'
AND npar_get_invoice_balance (ra.customer_trx_id,
'08-Sep-2011') <> 0
AND sa.salesrep_id(+) = ra.primary_salesrep_id
AND sa.org_id(+) <> -3113
and ra.purchase_order='2011-0526'
GROUP BY rac.customer_number,
rac.customer_name,
su.LOCATION,
ra.invoice_currency_code ,
ra.trx_number,
RA.PURCHASE_ORDER,
rad.gl_date,
ra.purchase_order_date,
ra.invoice_currency_code,
SUBSTR (sa.NAME, 1, 2)
with the following output
CUSTOMER_NUMBER CUSTOMER_NAME CONTRACT BU SUB_DATE CCY PURCHASE_ORDER TRX_NUMBER GL_DATE BALANCE_DUE
1002 Joint Operations (KGOC / SAC) JO/SA88/WO06 12 05/29/2011 KWD 2011-0526 2011-0526-M 05/23/2011 4,773.60
1002 Joint Operations (KGOC / SAC) JO/SA88/WO06 12 05/29/2011 KWD 2011-0526 2011-0526-S 05/23/2011 3,559.78
i require the following output
CUSTOMER_NUMBER CUSTOMER_NAME CONTRACT BU SUB_DATE CCY PURCHASE_ORDER TRX_NUMBER GL_DATE BALANCE_DUE
1002 Joint Operations (KGOC / SAC) JO/SA88/WO06 12 05/29/2011 KWD 2011-0526 2011-0526-M 05/23/2011 8333.38
1002 Joint Operations (KGOC / SAC) JO/SA88/WO06 12 05/29/2011 KWD 2011-0526 2011-0526-S 05/23/2011 8333.38
ie balance due is sum of the balances of trx numbers 2011-0526-M and 2011-0526-S(4733.60+ 3559.78)inorder to get this ouput i must avoid trx number from the group clause then only i get the sum of 8333.38,but i need trx number too in my query,
can this be achieved
kindly help
thanking in advance
hi
thank you very much for your timely help
i had to remove the extra sum function from your query as i was getting"window function not allowed here"
but the "partition by" really helped me
SELECT rac.customer_number, rac.customer_name,
su.LOCATION contract, SUBSTR (sa.NAME, 1, 2) bu,
ra.purchase_order_date sub_date,
ra.invoice_currency_code ccy,RA.PURCHASE_ORDER,ra.trx_number,
TRUNC (rad.gl_date) gl_date,
SUM(npar_get_invoice_balance(
ra.customer_trx_id,
'08-Sep-2011'
OVER(
PARTITION BY rac.customer_number,
rac.customer_name,
su.LOCATION,
ra.invoice_currency_code ,
RA.PURCHASE_ORDER,
TRUNC (rad.gl_date),
ra.purchase_order_date,
ra.invoice_currency_code,
SUBSTR (sa.NAME, 1, 2)
) balance_due_tot, SUM
(npar_get_invoice_balance (ra.customer_trx_id,
'08-Sep-2011'
) balance_due
FROM ra_customer_trx_all ra,
ra_site_uses_all su,
ra_cust_trx_line_gl_dist_all rad,
ra_customers rac,
ra_cust_trx_types_all ty,
ra_salesreps_all sa
WHERE TRUNC (rad.gl_date) <= '08-Sep-2011'
AND ra.bill_to_customer_id = rac.customer_id
AND su.site_use_code = 'BILL_TO'
AND su.site_use_id = ra.bill_to_site_use_id
AND ty.cust_trx_type_id = ra.cust_trx_type_id
AND ty.TYPE = 'INV'
AND ty.org_id <> -3113
AND rad.customer_trx_id = ra.customer_trx_id
AND rad.account_class = 'REC'
AND rad.latest_rec_flag = 'Y'
AND npar_get_invoice_balance (ra.customer_trx_id,
'08-Sep-2011') <> 0
AND sa.salesrep_id(+) = ra.primary_salesrep_id
AND sa.org_id(+) <> -3113
and ra.purchase_order='2011-0526'
GROUP BY rac.customer_number,
rac.customer_name,
su.LOCATION,
ra.invoice_currency_code ,
ra.trx_number,
RA.PURCHASE_ORDER,
rad.gl_date,
ra.customer_trx_id,
ra.purchase_order_date,
ra.invoice_currency_code,
SUBSTR (sa.NAME, 1, 2)
thanks a lot
Edited by: makdutakdu on Sep 26, 2011 8:03 AM
Similar Messages
-
How to get sum for each currency's in ALV Report
Hi,
A column has amounts with various currency's.
May I know how to get sum quantity for each currency in ALV Report?
Thanks in advance.Hi,
Currency value column should have reference to currency code column.
Regards,
Wojciech -
How to prevent a number field from getting summed?
I want to display the # of clients per a certain ID number. (In order to show the duplicate records by setting a filter in the # of clients field). However, this works if the ID number is a text field... but it doesn't work if the ID number is a metric of client... or number. It gets summed up, I get the total, and the % of clients turns to be 1.
Any ideas?
ThanksExample:
I have 3 clients:
Column A
55
55
44
21
I want the following output:
55 | 2
I get the desired result by adding a second column (# of clients) and creating a filter to get results only if the value is > 2.
The problem is when "Column A" is a number field. If it is a number field, I get total sum of the records (55+55+44+21) and a value of "1" if I add the # of clients column.
Is it clearer now? ideas? -
How to get sum of bugs for particular Mnth and particular Year dynamically?
Hi All,
I've a query related to dynamic date and year :
select bug_id,
category,
count(*) Total_bugs,
SUM(CASE when bug_date >= '10/1/2011' and bug_date <= '10/31/2011' Then 1 else 0 end) OCT_11,
SUM(CASE when bug_date >= '9/1/2011' and bug_date<= '9/30/2011' Then 1 else 0 end) SEP_11,
FROM AA_BUG_TBL
GROUP BY BUG_ID,BUG_CATEGORY
In the above query,Can we write one sum statement to get sum of bugs for a particular month and particular year dynamically?
for ex:2 bugs between 10/1/2011 and 10/31/2011 then 2 under oct_11
5 bugs between 09/01/11 and 09/30/2011 then 5 under sep_11
In this case we need to calculate correct no of days for feb
Thanks,
Mahender.So...
You need to iterate based on something like the month, quarter, year... Then query on that. I'll use a "WITH" clause to illustrate:
with my_bugs as
select bug_id
, bug_date
, case when to_char ( bug_date, 'QYYYY' ) = '12009' then 1 else 0 end y2009q1_bug
, case when to_char ( bug_date, 'QYYYY' ) = '22009' then 1 else 0 end y2009q2_bug
, case when to_char ( bug_date, 'QYYYY' ) = '32009' then 1 else 0 end y2009q3_bug
, case when to_char ( bug_date, 'QYYYY' ) = '42009' then 1 else 0 end y2009q4_bug
, case when to_char ( bug_date, 'YYYY' ) = 2009 then 1 else 0 end y2009_bug
, case when to_char ( bug_date, 'YYYY' ) = 2010 then 1 else 0 end y2010_bug
, case when to_char ( bug_date, 'YYYY' ) = 2011 then 1 else 0 end y2011_bug
, case when 1 = 1 then 1 else 0 end is_bug_flag
from bugs
select bug_id
, bug_date
, sum ( y2009q1_bug ) over () as total_bugs_2009q1
, sum ( y2009q2_bug ) over () as total_bugs_2009q2
, sum ( y2009q3_bug ) over () as total_bugs_2009q3
, sum ( y2009q4_bug ) over () as total_bugs_2009q4
, sum ( y2009_bug ) over () as total_bugs_2009
, count (*) over ( partition by is_bug_flag ) as total_bugs
from my_bugsI mocked up some data so my results will be drastically different than yours but here are the results:
BUG_ID BUG_DATE TOTAL_BUGS_2009Q1 TOTAL_BUGS_2009Q2 TOTAL_BUGS_2009Q3 TOTAL_BUGS_2009Q4 TOTAL_BUGS_2009 TOTAL_BUGS
2014 10-SEP-10 0 0 114 1143 1257 10000
2015 14-APR-10 0 0 114 1143 1257 10000
2016 30-NOV-09 0 0 114 1143 1257 10000
2017 03-JUN-11 0 0 114 1143 1257 10000
2018 29-DEC-10 0 0 114 1143 1257 10000
2019 12-JAN-11 0 0 114 1143 1257 10000
2020 21-APR-10 0 0 114 1143 1257 10000
2021 12-JAN-11 0 0 114 1143 1257 10000
2022 29-NOV-10 0 0 114 1143 1257 10000
2023 20-JUL-11 0 0 114 1143 1257 10000
2024 04-MAR-11 0 0 114 1143 1257 10000 -
Getting sum of each column in 2D array
hi,
i want to get sum of each column from 2D array. i did public static void main(String[] args) {
double sum=0.0;
int[][] arr={
{1,2,8},
{2,2,3},
{2,2,5},
{1,2,8},
{1,1,9},
{2,2}
int i=0,j=0;
int len=arr.length;
while(j!=len){
sum=0;
for(i=0;i<arr.length;i++){
sum+=arr[i][j];
System.out.println("sum is:" +sum);
j++;
}but it doesnot work for jagged array...somebody please help!
thankxStop assuming the rows in your matrix are all the same length. Arrays know how long they are. Use that information to determine if the current column exists in that row.
-
How to get sum amount (wrbtr) from table BSIS group by gjahr hkont monat
Hello! I am new to this forum, and to ABAP. Hope my question is not obvious.
I want to get sum amount from table BSIS, group by year, period an account. Normally I will try a SQL select like this:
SELECT gjahr monat hkont sum( wrbtr ) as wrbtr INTO CORRESPONDING FIELDS OF TABLE itab FROM BSIS WHERE (itabcond) GROUP BY gjahr monat hkont .
The problem is that the amount in field wrbtr is all positive. The result gets wrong. The debet/credit indicator shkzg determines what is positive/negative. How to solve this in the most efficient way? Should I read all accounting documents into an internal table, and loop through them, changing the sign, and then make some new select, or is there a better way?
Regards Dag-Egil
Message was edited by:
Dag-Egil Bull SletholtHere are the objects in the trace list:
SKB1
USR05
TRDIR
SKA1
SKAT
SKB1
BSIS
PRPS
BSAS
V_LTDX
USR02
RFBLG
V_LTDX
LTDX
RTXTH
RTXTF
RTXTT
TRDIR
The most of this call to this tables returns 1-2 records, apart from BSIS, where it returns 10 records. This is the same as accounting documents in the transaction FBL3N. When i try this again with more records returned I still have no call to table GLT0. -
How to get Sum for my Elapse Time string for my group
Hi,
How can I get the sum of an elapse time string in my group footer 2 and group footer 1 from the report screenshot attached.
I have a report that display TimeIn and TimeOut of an employee.
For the total time I have created a formula that will take my time in seconds and displaying it in hrs, minutes and seconds.
How can I get the sum of all the total time per day and display this in my group footer 2.
As well I will need to add the grand total to group footer 1 for the total of days.
The formula I have for the total time is as follow:
WhileReadingRecords;
NumberVar TotalSec := {TimeLogs.TotalTime};
NumberVar Hours := Truncate (Remainder ( TotalSec , 86400) / 3600) ;
NumberVar Minutes := Truncate (Remainder ( TotalSec , 3600) / 60) ;
NumberVar Seconds := Remainder (TotalSec , 60) ;
Totext ( Hours , '00' ) + ':' +
Totext ( Minutes , '00' ) + ':' +
Totext ( Seconds , '00' )
This is a seperate question below but related as well to this report.
Another question I have is how can I round up for example 03:30:58 to 03:31:00
And also how can I round down for example 03:26:10 to 03:26:00
Any help would be appreciated.
Thank you,
JoeHi Jamie,
Well I ran into an issue with this. My Daily Total, there is no issue, it is displaying the proper time. But when I add a summary to my Group Footer 1, it doesn't add up properly.
If I select only 1, 2, or 3 days my Date Range Total is adding fine but when selecting 5 days for example, as you can see from the picture below, for an unknowned reason the total of hrs is wrong.
Do you know why this is happening.
Than you for your help.
Joe
Picture below, this is working fine? -
Acrobat Pro 9 - How To Get Sum of Highlighted Text
I am trying to find the best way to add numbers from scanned documents. I would like to use the highligh feature to mark the numbers I am going to add up and get a total sum of those combined numbers as I go. Is there a way to do this?
If not is there a way to take just the highlited areas and put them in a line by line so it would be easy to see just the highlited text?
Expamle Line by line:
$1.50
$2.50
$11.95
ect..
Even better would be to have a line by line of the highlighted text with a sum.Lots of issues!
A scanned page is just an image no text. So you need to OCR the document.
"Highlight" is a comment and only the highlight annotation and has no content unless a comment text is added to the highlight. So just the highlight over an image or text knows nothing about what is covered but you could find its location.
Acrobat knows only words and location of words on the page. So you would need to have a script to match the location of the highlight's location to a words location. You may need to adjust for rotation of pages.
You then need to convert a text field with numbers as text to numbers.
To display the number, you will need to dynamically add fields and the computed value or the formula to compute the value.
All of this is just to much to cover in a single forum post. -
How to get sum distinct in the cube. Is it possible.
Here is the scenario.
One report has many countries on it but only one amount.
For a particular day we have the following data in the fact.
TRANSACTION_DAY_NO
Country
Total Amount
19900101
US
34
19900101
IND
35
19900101
IND
36
19900101
AUS
37
19900101
UNKNOWN
38
19900101
UNKNOWN
39
19900101
UNKNOWN
40
19900101
UNKNOWN
41
19900101
UNKNOWN
42
19900101
UNKNOWN
43
19900101
US
43
19900101
IND
42
There are 2 dimensions on the cube.
Date, Country.
I am not sure how to build a cube on this data.
with t as (
select 19900101 transaction_Day_no, 'US' country_no, 34 total_amount from dual union all
select 19900101, 'IND', 35 from dual union all
select 19900101, 'IND', 36 from dual union all
select 19900101, 'AUS', 37 from dual union all
select 19900101, 'UNKNOWN', 38 from dual union all
select 19900101, 'UNKNOWN', 39 from dual union all
select 19900101, 'UNKNOWN', 40 from dual union all
select 19900101, 'UNKNOWN', 41 from dual union all
select 19900101, 'UNKNOWN', 42 from dual union all
select 19900101, 'UNKNOWN', 43 from dual union all
select 19900101, 'US', 43 from dual union all
select 19900101, 'IND', 42 from dual
select transaction_day_no, country_no, sum(distinct total_amount) from t
group by cube(transaction_Day_no, country_no);
I am using AWM. I have tried to build by selecting the following aggregate for the cube
max for the country_no and
sum for the tranaction_Day_no
But i am getting incorrect results.
If i select sum for both country_no and transaction_no then also i get incorrect results.
Please help me solve this issue.
thanksThanks for all your reply's.
The problem is that i have duplicates because
One report can have many customers.
One customer can have many countries.
One customer can have many reports.
If i include the report number in the above data and do a sum on both day and report_number and max for everything else then everything is find and i am getting correct results.
But if i take out the report dimension then i am stuffed.
Also the problem is that i can't have one big dimension for the report as the number of reports are in access of 300M
We have tried to solve this issue by having the fullowing.
Dummy Cube.
This has all the combination of all the dimension in the fact table with the report dimension as only one row(-1)
Report Dimension for each Quarter(34M rows each)
Quarter Cube is build.
Then add the values from all the Quarter Cube with the Dummy Cube.
Tried for 2 Quarter and its working fine results are correct as well.
Only problem is that its taking a long time to build the cube because of the report dimension.
I am trying to find a way to remove the report dimension but still use it. As we only use report dimension at level 'ALL'
But if we do aggregation at 'ALL' level the answers are wrong again.
Thanks for looking into this and taking time to reply.
Regards
Alvinder -
How can i write a code to get sume of value from days.
Hi,
how can i write a code to get the sum of value of days(example 1 to 30).
This is in BPS ...
i created multi planning area and creted planning function with {keyfigure name,planning area,days}.
now i want to read all the actual values from basic planing area(basic cube) and calculate the sum of the value.if you have idea can you share the code.
ENTRIES = VARC ( 'zvardays' ). ex(zvardays like 28 days or 29 days or 30 days or 31 days)
COUNT = ENTRIES.
*Get the all the days value from actual
FOREACH PAREA = 'basic planning area'.
COUNT = 1.
DO
SUM = SUM + {amount, count} (amount is a keyfirgure value)
ENDDO.
COUNT = COUNT+1.
SUMACT = SUM.
ENDFOR.
can you correct the above code ....to read the values and sum of the those value.
Thanks...Hi ..
That is ok..
Can you provide sample code for my requirement..
and also how can i pass the error message (can you help me syntax )
and if my acutal-total is not equal to plan-total then
i have to pass the error message and then i have to restrict save the data how i can i restrict(user can not save the data until the values should be equal) .
Can you help me it is very urgent..
thanks.//
Edited by: Eyda rose on Jun 4, 2008 9:29 PM -
How To Get "≈" Sums?
Hi. Am a long-time Mac user, but still relatively new to Numbers.
I've created some basic expense tables, each with about five columns. The final column represents the final cost of a particular item, including tax -- but sometimes that final number is just an estimate. It's those cells with an approximate number which are the problem, because whenever I enter the "≈" sign (Opt-x) before the amount, or put a "?" after the amount, that cell gets completely ignored (computationally) when I then select a range of cells in that column, and want to see the Sum for that selected range.
So the question is: How can I clearly indicate that the number in a particular cell is an estimate (or even just a best guess), but still have that number included in any SUM (or any other calculation) which includes that cell in its selection?
Any suggestions greatly appreciated.
Thanks,
John Bertram
TorontoThanks for both the suggestions. And from both, am I correct in assuming that cells with numbers -- in this case currency values -- cannot contain ANY "text annotations" anywhere within the cell (even just symbols such as "≈" or "?"), if the value of that cell is to be included in any calculations?
And if that is in fact the case - - I'm thinking my easiest route will be to just squeeze in one extra column -- either to the left of the main one, with space to simply type in the "≈" symbol when appropriate; or to the right, again with just enough space to either type a "?" or not.
I'll of course just know that any SUM I generate from any section of that last main column (when the selection of cells contains one or more of those estimated amounts) will itself be an approximate total.
For the kinds of personal expense tables I'm creating, I probably don't need a formula to cause checkboxes in one column to auto-enter special text in another -- but thank you for posting the example, it does look very cool, and has reminded me that I need to look into the whole world of creating custom formulas.
Any other suggestion still welcome; meantime thanks for these.
John Bertram
Toronto -
Hi Experts
I stuck with small problem ,any one please solve the problem i appreciate ur help
Below is my table , i need to get maximum operation i..e from order 10 the maxi operation is #/02 and for order 20 operation is #/01 . and i need to sum it up for respective operations Actual qty values ..
Ext material grp Order Number Operation key Actual Qty
100 A.H 10 #/01 200
100A.H 10 #/02 300
100 A.H 20 #/o1 100
100 A.H 30 #/02 400
i want to show the table like
Operation Keys
Ext material grp 10 20
100A.H 100 700(300+400 )
All Objects from same dataprovider,
Please help me on this .Hello,
I am having some difficulty interpreting your requirement. You say:
I need to get maximum operation i..e from order 10 the maxi operation is #/02 and for order 20 operation is #/01
Is the output you described more likely to look like that below?
Ext material grp..... Order Number.....Operation key.....Actual Qty
100 A.H.........................10....................... #/02.............. 500 (200 + 300)
100 A.H........................ 20....................... #/01...............100
100 A.H........................ 30....................... #/02...............400
If so, you could use extended syntax to pull back the max operation key and actual qty sum in the context of each ext material grp, order number combination (or whatever dimensions are needed to give you the grain needed). EG
max operation key = max (operation key) in (ext material grp; order number)
sum actual qty = sum(actual qty) in (ext material grp; order number)
Hope this helps
Jacqui -
Get sum of fields using ListData.svc or API?
I want to make a call to ListData.svc or the API through a URL and get a sum of a field back based on the filter criteria I send. Is there a way to do this?
Hi,
There would not be such aggregation function in CAML query or OData query when sending a restful request:
http://msdn.microsoft.com/en-us/library/office/ms467521(v=office.15).aspx
http://msdn.microsoft.com/en-us/library/office/fp142385(v=office.15).aspx#sectionSection7
As a workaround, I would suggest you do the math in client side with the data retrieved.
Thanks
Patrick Liang
Forum Support
Please remember to mark the replies as answers if they
help and unmark them if they provide no help. If you have feedback for TechNet
Subscriber Support, contact [email protected]
Patrick Liang
TechNet Community Support -
Formula to get sum of records per page
Post Author: dreamer_0244
CA Forum: Formula
Hi! I'm trying to create a formula that would get the sum of a field within each page of the report.
Does anyone have an idea on this? Thanks!Post Author: bettername
CA Forum: Formula
If you want something at the bottom of the page that says "Total sales for this page = £1385.55", then you'd create a formula in the group header that sets a variable to be 0. Then add to this variable for each record, and then display it in the page footer:
In page header (suppress formula):
whileprintingrecords;
numbervar mytotal:=0;
In details section (suppress formula):
whileprintingrecords;
numbervar mytotal:=mytotal+
In page footer:
whileprintingrecords;
"Page total = "+totext(numbervar mytotal) -
Hi All
Can any body help me explain how can we upload data via excel in SSM. Exactly same data in the excel needs to be moved to PAS. For eg the value should not get aggregated at parent level rather display the data the way it is passed through excel.
Right now I'm facing issue that values is getting either summed up or avg at parent node and not picking the value passed through excel.
Where and what setting needs to be changes to resolve my issue.
Regards
RohiniHi Rohini,
If you are already loading values at all levels of the dimension, you won't need to run the consolidation for those metrics.
You do have to run the consolidation for the metrics to which you are only loading INPUT data.
And if you have metrics for which the members should get aggregated along the hierarchy using only SUM or AVERAGE, then you can choose to load all the hierarchy, or just the INPUT members with a consolidation running afterwards. Loading INPUT members and consolidate could have better performance. Also, if you need to change just one member of the dimension for the metric, you wouldn't need to load the full hierarchy, a consolidation would ensure all values were consistent.
Regards,
Ricardo
Maybe you are looking for
-
suddenly the map has disappeared and an advert for mobilme has appeared ..... even when trying in iweb to put it back before uploading, it doesn t come back. anyone seen anything like it and any way to correct it? Mark
-
Hi, I have a mobile IOS application that utilizes the TabbedViewNavigatorApplication component. The app has a skin that defines a background image for the entire app, and the skin is defined as an actionscript class. On one of my views, I am displayi
-
ACCOUNT DETERMINATION "INTERCOMPANY SALES &3RD PARTY SALES" -kishore,AK ,
HI , Rajesh , Kishore , AK , well 2day i had client interview , he was very much stressing on " ACCOUNT DETERMINATION " process in intercompany sales , both in ordering comapny and delvering plant . At the same time account de
-
Object status for a sales document
Hi I have maintained one status profile with 3 status and assigned it quotation document (Quotation -> Stauts Data - > Object status -> 3 new status in radio buttons ). In which table can i see that this document number and status of document? Tj30t
-
Picking UTF-16 coded xml file thru file adapter
Dear All, We are working on an interface in which we are receiving an XML file in UTF-16 format. Now we want to send this file to a RFC in SAP. We are getting an error in picking the file as UTF-16 file format is not getting picked. Also we are not a