Calculate closing balance
Hi everyone,
I've got a problem with writting a formula wich will calculate a closing balance for each account side, I mean debet and credit. In my SQL database I've got columns with: OpeningBalanceDt, OpeningBalanceCt , DtTurnover, CtTurnover, IDaccount and TIMEID.
When I create a Calculated Field:
BalanceDt:=IF(([OBDt+Dt]-[ObCt+Ct])>0;[OBDt+Dt]-[ObCt+Ct];0)
BalanceCt:=IF(([ObCt+Ct]-[OBDt+Dt])>0;[ObCt+Ct]-[OBDt+Dt];0)
it works for particular account eg:11575, but it doesn't when I remove filter and check global account nr 111 (then I have per account result).
Do you have any idea what formula I need to write to have a proper view it pivot table for both account side ? Meaby I need to create a calculate column not filed...
The problem concerns the fact that pp check columns globally and then compare calculeted sum. In this case global sum of BalanceDt has a higher value than BalanceCt so the final balance is Dt.
In excel I can calculate 2 columns:
=if((OBDt+Dt-(ObCt+Ct))<=0;0;OBDt+Dt-(ObCt+Ct))
=if((OBCt+Ct-(ObDt+Dt))<=0;0;OBCt+Ct-(ObDt+CDt))
and when I create a sum I've got a proper result. Maybe the solution will be in grouping the accounts and then conduct a comparision.
Thanks in advice,
Paul
Hi,
I will change a subject a little bit. Now I have the following columns:
ObrotyKontID, WN, MA, BO_WN, BO_MA, KontoFinansoweID, KontoSyntetyczneID and TIMEID. Guy from ERP wrote two formulas which works perfect in system and calculate closing balance for each account side:
Debit
Sum(Filter(existing[KontoAnalityczne],[Measures].[ObrotyWNNar]>[Measures].[ObrotyMANar]),[Measures].[ObrotyWNNar]-[Measures].[ObrotyMANar])
Credit
Sum(Filter(existing[KontoAnalityczne],[Measures].[ObrotyWNNar]<[Measures].[ObrotyMANar]),[Measures].[ObrotyMANar]-[Measures].[ObrotyWNNar])
and 2 more formulas to calculate Debit and Credit
ObrotyWNNar
Sum(StrToMember("[Czas].[Miesiąc].&["+left(Tail(existing [SET_Data]).Item(0).Properties("KEY"),4)+"01]"
):StrToMember("[Czas].[Miesiąc].&["+left(Tail(existing [SET_Data]).Item(0).Properties("KEY"),6)+"]"
),[Measures].[ObrotyWN]+[Measures].[BO WN])
ObrotyMANar
Sum(StrToMember("[Czas].[Miesiąc].&["+left(Tail(existing [SET_Data]).Item(0).Properties("KEY"),4)+"01]"
):StrToMember("[Czas].[Miesiąc].&["+left(Tail(existing [SET_Data]).Item(0).Properties("KEY"),6)+"]"
),[Measures].[ObrotyMA]+[Measures].[BO MA])
I have got the same sum in ObrotyWNNar by forumla
=[WN]+[BO_WN]
and ObrotyMANar by
=[MA]+[BO_MA]
However I can't create proper formulas in powerpiwot which calculate Debit and Credit. I suppose that I need to use some agregate formulas like SUMX.
If anyone have any idea ?
Thanks in advice,
Paul
Similar Messages
-
Opening balance and closing balances for discounts?
Hi all,
I have a typical sceanario where in
opening balance for discounts 10,000 (balance of last month)
actual discounts from the sales order 5,000
manual upload is from flat file 2,000
closing balance is 7,000 (which is opening balance + manual upload - actual discounts)
opening and closing balance needs to be calculated, how to calculate nor handle this on every month?
level of granularity of the data is
sku, month, rebate category and rebate amount?
ThanksHi Pooja,
can you please let us know few things about your report requirements
What is the extractor you are using?
What are the KFs ?
what are the selection parameters that you want to enter at the reporting level?
is it the report related to FI AR. do you want to display the values based on the customer -->profitcenter?
Bcoz we had a same requirement where our requirement was global recievables aging report in which the report need to display opening bal, sales,adjustment,colelction and closing balance and the aging values.
here what we did is changed the modeling of the DSO and infocube.
we had used non-cumulative KF in order to calculate closing balance and from that derived opening balance and again create a new formula to get the closing balance.
if you can be specific with your requirement hope can help you with your report. -
How to calculate opening and closing balance for period
Hi all,
i have to find out opening and closing balance.
the table structure of temporary table is
select * from hwcn_xn_fa_report_temp1 where asset_id=10029400
PERIOD_COUNTER CST_OP_BAL CST_ADDITION CST_TRANSFER CST_DISPOSAL COST_CLOSING_BALANCE
24108 0 0 0
24109 12000
24110 0 0 0
24111 0 0 0
in this table cst_op_balnce and cost_closing_balace is null
i have display cost_op_bal and cost_closing_balnce
cost_closing_balance=cst_op_bal+cst_addition+cst_transfer+cst_disposal
for period 2408 op_balnce=0 closing_bal=0
for period 2409 op_balnce=0 closing_balce=1200
for period 2410 op_bal=1200 closing_bal=1200
closing balance of dec will be opening bal of jan
thanks and regards
Edited by: user10664276 on Apr 19, 2009 11:08 PM
Edited by: user10664276 on Apr 19, 2009 11:13 PMHi,
user11118871 wrote:
Can you explain what that is? Thank you if you have one example.
ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING
When you use the analytic SUM (c) function, then, on each row, it returns the values of column (or expression) c from several rows in the result set added together.
Which rows? That depends.
If the analytic clause (the part in parentheses after OVER) does not include ORDER BY, then it is all rows.
If the analytic clause has an ORDER BY clause, but no windowing clause (that is, ROWS BETWEEN ... or RANGE BETWEEN ...), then the rows included in the sum are all rows up to and including the row where the function is being called (as sorted by the analytic ORDER BY).
If the analytic cluase has both ORDER BY and a windowing clause "ROWS BETWEEN x PRECEDING AND y PRECEDING", then the rows included in the sum are the rows from x to y rows before the one where the function is called.
Do some experiments with different values of x and y.
First, create a table like the one in the problem above, but simplified a little.
CREATE TABLE test_sum
( period NUMBER
, new_amt NUMBER
INSERT INTO test_sum (period, new_amt) VALUES (24108, 1);
INSERT INTO test_sum (period, new_amt) VALUES (24109, 4);
INSERT INTO test_sum (period, new_amt) VALUES (24110, 2);
INSERT INTO test_sum (period, new_amt) VALUES (24111, 8);
INSERT INTO test_sum (period, new_amt) VALUES (25001, 32);
INSERT INTO test_sum (period, new_amt) VALUES (25002, 16);
COMMIT;The original problem above used names that were meaningful for its application, and columns that have nothing to do with the SUM function. Let's simplify the former and lose the latter.
That problem involved the SUM of three columns added together. Since we just want to understand how the windowing clause works, let's simplify that to one column.
With these simplifications, my original query is:
SELECT period
, new_amt
, SUM (new_amt) OVER ( ORDER BY period
ROWS BETWEEN UNBOUNDED PRECEDING
AND 1 PRECEDING
) AS opening_balance
, SUM (new_amt) OVER ( ORDER BY period
) AS closing_balance
FROM test_sum
ORDER BY period;Given the data above, it produces these results:
. PERIOD NEW_AMT OPENING_BALANCE CLOSING_BALANCE
24108 1 1
24109 4 1 5
24110 2 5 7
24111 8 7 15
25001 32 15 47
25002 16 47 63So, for example, on the row where period=24110,
opening_balance=5, which is the total of new_amt from all rows up to but not including that row: 5=1+4, and
closing_balance=7, which is the total of new_amt from all rows up to and including that row: 7=1+4+2.
To really understand how the windowing clause works, do some experiments. Change the definition of opening_balance to include " BETWEEN x PRECEDING AND y PRECEDING". You'll find that:
(a) "UNBOUNDED PRECEDING" means the same as "n PRECEDING", where n is greater than the number of rows in your result set.
(b) "CURRENT ROW" means the same as "0 PRECEDING"
(c) x must be greater than or equal to y
(d) neither x nor y can be negative (but you can use "FOLLOWING" instead of "PRECEDING" to get the same effect).
For more, see the introduction to "Analytic Functions" in the [SQL Language manual|http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/functions001.htm#sthref972]
When you're finished, don't forget to
DROP TABLE test_sum; -
Insert and update query to calculate the opening and closing balance
create table purchase(productid number(5) ,dateofpurchase date,
qty number(5));
create table inventory(invid number(5),productid number(5),
idate date,openingqty number(5),closingqty number(5));
Records in inventory:
1,1,'01-jan-2009', 10, 20
2,1,'03-jan-2009', 20, 30
3,1,'04-jan-2009', 40, 50
when I enter the purchase invoice for 15 qty on 02-jan-2009
after say '15-jan-09' , a new record should get inserted
with opening balance = (closing balance before 02-jan-2009)
and all the opening and closing balance for that product should
get affected.
If the invoice for 20 qty is entered for the existing date say
'03-jan-2009' in inventory , then the closing balance
for 03-jan-2009 should get updated and all the following records
should get affected.
I need the insert for the first one and update query for the
second one.
Vinodh<strike>You can do this in one statement by using the merge statement</strike>
Hmm, maybe I spoke too soon.
Edited by: Boneist on 25-Sep-2009 13:56
Thinking about it, why do you want to design your system like this?
Why not simply have your purchases table hold the required information and then either work out the inventory on the fly, or have a job that calls a procedure to add a row for the previous day?
If you continue with this design, you're opening yourself up to a world of pain - what happens when the data doesn't match the purchases table? Also when is the inventory cut-off to reset the opening/closing balances? Monthly? Annually? Weekly? If it's set to one of those, what happens when the business request the inventory for a particular week?
Edited by: Boneist on 25-Sep-2009 13:59 -
GL account opening/closing balances by day
Hi All.
I wish to list day by day opening and closing balances of G/L account by restricting the result to a time interval.
Anyone know how to write the query for G/L account opening & closing balances by day?
I found this in the forum and modify it to below:
declare @fr char(10)
declare @to char(10)
set @fr=convert (char(10),[%0],20)
set @to=convert (char(10),[%1],20)
declare @PrCl dec(19,6)
declare @de dec(19,6)
declare @cr dec(19,6)
declare @acc char(20)
declare @Pracc char(20)
Create table #W
(M char(10), Acc char(20), Me char(100), Tid char(10), Br char(10), TT char(30), Op dec(19,6),De dec(19,6),Cr dec(19,6),Cl dec(19,6) )
Insert into #W (M,Acc,Me,Tid,Br,TT,Op,De,Cr,Cl)
SELECT convert (char(10),T1.[RefDate],20)Mo, T1.[Account],T0.Memo, T0.TransId, T0.BaseRef, CASE
WHEN T0.TransType = 13 THEN 'AR Inv'
WHEN T0.TransType = 14 THEN 'AR CN'
WHEN T0.TransType = 18 THEN 'AP Inv'
WHEN T0.TransType = 19 THEN 'AP CN'
WHEN T0.TransType = 24 THEN 'Incoming Payment'
WHEN T0.TransType = 30 THEN 'JE'
WHEN T0.TransType = 46 THEN 'Outgoing Payment'
ELSE 'Other'
END AS 'Trans Type',
0,T1.[Debit] De , T1.[Credit] Cr,0
FROM OJDT T0 INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId
Group by T1.[Account],convert (char(10),T1.[RefDate],20),T0.Memo, T0.TransId, T0.BaseRef, T0.TransType, T1.Debit, T1.Credit
Order By T1.[Account],convert (char(10),T1.[RefDate],20)
Declare cu cursor for
Select acc,de,cr from #W
for update
set @PrAcc=''
Open cu
Fetch next from cu into @acc,@de,@cr
While @@FETCH_STATUS = 0
Begin
If @acc!=@PrAcc set @PrCl=0
Update #W
set op=@PrCl,
cl=@PrCl-@Cr+@de
where current of cu
set @PrCl=@PrCl-@Cr+@de
set @PrAcc=@acc
Fetch next from cu into @acc,@de,@cr
End
deallocate cu
Select * from #w
Where M between @fr and @to
Drop table #W
but some of the rows are missing from the result. e.g. row with the same value of debit/credit ( same TransId and BaseRef) will come out once only in the result.
Please guide me on the above issue.
Thanks & Best Regards,
LengHi,
You have to make use of many tables for this purpose.
1. You have to claculate the previuos period and finscal year for the given date..
2. You have to calculate the G/L balances for this period for the given G/L account from table GLT0.(You can use some of the standard function modules for the same)
3. You have get the line items from the various tables like BSIS,BSAS,BSIK, BASK, BSID and BSAD for the dates from the begining of the month to the given date-1. sum upthis amount with the amount retrieved from step 2 .This will be the opening balance for the given date.
4.retrieve the data from he same tables like step 3 for the given date. This will the transactions of the given date.
5. sum up the amounts from step 4 with step 3. this will be the closing balance for that date.
let me know id you want any further info..
Reward the points if i answered your question.. -
Opening & closing balances for Vendor
Hi Experts,
I am doing a report where in i need to get the opening & closing balances for Vendor(s). I am using BSIK & BSAK tables. Are there any more tables involved and how do i carry out the calculations?
Please help.
Thanks
DanyHi,
There are various t. code to check line items for vendor like: S_ALR_87012103 but Any table is not helping to check opening/closeing balance for vendor.
Table BSIK and BSAK are having are records for open items and close items for vendor and system calculate the balance by using these tables.
Regards,
Vinod -
Debit,credit ,opening balance,closing balance..doubt.
Dear friends,
I am working in FI report (vendor balance for date ranges) .Its a ALV report. I want to fetch the datas for debit ,
credit,opening balance,closing balance,for the paticular vendor or all vendors for date ranges.the table for this iam using is BSIK AND LFC1.
all the datas stored in the table is for month wise,but my programe (my user needs even for day wise) how to calculate this,
or is there any function modules avaliable or can u konw any other table storing day wise balances...this report is urgent ..
any one pls suggest me .advance thanks..
regards
veeraif user wants day wise then make use of BSAK+BSIK, here u will get all line items daywise , i mean to say Posting daywise.
BUDAT 31.03.2003---->posting date
BLDAT 31.03.2003
CPUDT 31.03.2003
WAERS INR
XBLNR T&E-29-30.3-PNPT
BLART PA
MONAT 3
BSCHL 31
ZUMSK
SHKZG H------------>D/C
GSBER--------------------->Business Area
MWSKZ-------------------->tax Code.
DMBTR 1,507.00
WRBTR 1,507.00
regards
Prabhu -
Hi experts.
I am looking for a formula to calculate opening and closing balance @ query level.
points are waiting.Hi,
I think you are using 0IC_C03 Cube.
You can get ...liek below
Opening Stock Qty =
Valuated stock qty-- 0VALSTCKQTY
Calendar Year/Month 0CALMONTH
Z_SNGVAL-1
Restrict 0VALSTCKQTY keyfigure with 0CALMONTH , Z_SNGVAL (Less then or equal to) is user entry Variable for Month, so Z_SNGVAL-1 give OIpening Stock.
Closing Stock..
Valuated stock qty ---0VALSTCKQTY
Calendar Year/Month 0CALMONTH 8
<=SNGVAL (Restrict with Less then or equal to)
Thanks
Reddy -
Opening and closing balance values at storage location level
Dear all,
I want to know opening and closing balance values and receipts and issue values at storage location level for certain period.
I tried with MB5B, it is not giving value at storage location level, it is giving quantities at storage location level and values at plant level. But requirement is: please see below example:
All values are in USD
Storage location: 1001 1002
Opening Balance: 2000 3000
Receipts: 1000 2000
Issues: 2000 3000
Closing Balance: 1000 2000
Please help in this regard (I want value of the stock only, not qty)
Regads,
Veerappa
Edited by: Chinna Veerappa on Jul 27, 2010 5:27 PM
Edited by: Chinna Veerappa on Jul 27, 2010 5:28 PMvlauation is at plant level (MBEW table) the storage location level does not carry values (table MARD).
You may have to develope your own ZMB5B program and calculate yourself what is not stored in SAP. -
Closing balance of january to be carried forward as February opening bal.
Hi Gurus,
I am looking for the script logic which helps me to carry the closing balance of a month to the next month as opening balance. Please can anyone help me with the code.
Thanks in advance.
Regards,
KumarMG
Edited by: KumarMG on Jun 7, 2011 4:40 PMHi Kumar,
From consolidation perspective, carry forward is a period-end activity and has to be done every period. CATEGORY dimension has a property called OPENING_PERIOD which can be used to define the source period from where you want to copy the data. The target period is defined as variable in the data manager package. So you have to run it for each period.
Normally, we bring closing balances from ECC (or any other source system) and also load supplemental movements types (F_120 etc). Then we use default logic (as shown below) to check the data integrity and post differences in error flow.
[ACCDETAILDIM].[#F_ERR] =IIF([ACCOUNTDIM].CURRENTMEMBER.PROPERTIES("DIMLIST1")="L1_E", [ACCDETAILDIM].[F_999] - [ACCDETAILDIM].[F_100] - [ACCDETAILDIM].[F_120] + [ACCDETAILDIM].[F_140],0)
Say if you are loading periodic data from source systems (ECC) and want to calculate the closing balance from openings/movements then you can create a script logic for the same. You can also use transformation rules and post the closing balances. -
EBS Importing Opening / Closing Balances
I am Importing EBS via transation FF.5 (APACS EBS), the file is importing all details except the Opening Balance and Closing Balance. I have checked Algorithm and they are set up. Using 4.7 Enterprise. Has anyone got any suggestions.
Hi,
There are various t. code to check line items for vendor like: S_ALR_87012103 but Any table is not helping to check opening/closeing balance for vendor.
Table BSIK and BSAK are having are records for open items and close items for vendor and system calculate the balance by using these tables.
Regards,
Vinod -
Calculating Opening & Closing Balances
Hi Experts.
I want to know how to calculate Opening & closing Balances of stock Like MB5B transaction using reports.
I am giving Material N0, Posting date,Plant as Input
& want to extract Material Document Number, Quantity, Issues & receipts seperately, Opening & Closing Balance of Stock.Also it should be performed day wise.
This report should be a normal report without using ALV's.
Can Some Body Help me. Also let me know which tables & fields are being used.
Thanks.
Ravi SHi,
There are various t. code to check line items for vendor like: S_ALR_87012103 but Any table is not helping to check opening/closeing balance for vendor.
Table BSIK and BSAK are having are records for open items and close items for vendor and system calculate the balance by using these tables.
Regards,
Vinod -
Bank Interest Calculation on Opening and Closing Balance
Hi Experts,
I have quiry on bank interest calculation. when was run F.52, giving one months (01.04.2008 to 30.04.2008) calculation period that time system calculate interest from 01.04.2008 to 30.04.2008.
System calculate interest on Balance Carryforward amount.
But why the system do not calculate interest on Closing Banlance ?
1) We do not want the system to calculate interest on Balance Carryforward Amount.
2) And we want the System to calculate interest on 30.04.2008 (that is on closing balance).
How this can be done?
Reliable answer get huge points
Regards,
Jemesvlauation is at plant level (MBEW table) the storage location level does not carry values (table MARD).
You may have to develope your own ZMB5B program and calculate yourself what is not stored in SAP. -
Opening Balance an closing balance
Hi Gurus,
Please consider the following
1. Closing Balance for month of February is the opening balance fro March
2. The closing balance is calculated in BW during execution of the report
2. How do i show the February closing balance as the opening balance for the month of March in the same report
Your help highly appreciated
TQ
BR
BRHi,
As per my understand you have IOBJ " Closing Balance" this value is populating at teh time of query execution.
Then create a Form,ula (Put the Description as Opening Balance).In the Formula screen put the IOBJ " Closing Balance"
Means Opening Balance = Closing Balance.So u routput diplays closing and oprning.
Back end executionn :
1. First It will calculates the closing balnace (Already you will mainatian this IOBJ in your query structure) while diplaying it will displays the value in two columns for Closing and Opening(Formula that we have created in Query).
Try the above i think its definetly works.If not let me know
Regards
RAM.
Edited by: Ramakanth Deepak Gandepalli on Dec 22, 2009 10:54 AM -
Table name of Customer opening balance & Closing balance
Hi Gurus.,
I want to know the tables in to which the customers opening balance and closing balance is posted,
VERY VERY URGENT
Thanks & Regards
Narayana
Message was edited by:
manam narayanaHi Manam,
You cann't find opening/ closing balance in any table.
T. Code for opening/closing baloance is FBL5N.
SAP calculate opening/closing balance by using table BSID (Open items) and BSAD (Closed items).
Regards.
PS: Assign points if useful.
Maybe you are looking for
-
The AOL address I was using for my iTunes account has been deleted due to me not signing in for awhile and I'm afraid that I will lose all of my purchases made from my iphone when I sync it into iTunes for a much needed update and so that I can (hope
-
Images appearing as little blue box with a question mark
Hi, I have Safari version 3.1.1 and in the last two weeks, I've been missing data and having in it's place a small little blue box with a question mark show up in Safari and in some of my mail downloads too. Can anyone assist Thanks Tony p.s. I have
-
I am currently using IPhone 4, but recently bought an IPhone 4s. Is it possible for me to keep using both phones? The IPhone 4 will just be an Ipod Touch and Iphone 4S will be my new phone. Thanks..
-
I have a spare harddrive id like to use across XP and OSX, however is thee a file format i can format it to, to read/write natively on each without a filesize limit? or is that the silver lining? thanks!
-
How to get each column position in JTable?
I want some buttons appear at the top of each column. For example, Button1 Button2 Button3 | column1 | column2 | column3 | |--------------------------------------------| ...But button1,2 and 3 should be at the top of the column1, 2 and 3. So th