HFR: How to calculate variation over last period for dynamic columns
Hello Everyone,
How to calculate the period wise variation in a report where the period columns are dynamically generated from a range function? For example, the range function in the period column is &Current:Dec. What formula can I write in a calculated row so that the value is (Current Period - Previous period)*100/Previous period ?
Thanks,
Sayantan
You can add two more data rows.
1. Use &Current
2. Use relativemember function, select &Current, offset -1 (If you've a subvar for previous month that's the best)
3. Add a formula row ([B]-[C]*100/[C])
Regards
Celvin
http://www.orahyplabs.com
Similar Messages
-
How to open and close posting period for both material , n invoicing
HI
how to open and close posting period for both material , n invoicing , AM NEW TO SD , SO ALL DOUBTS I DO POST IN HERE PLEASE DONT MINDHi Sunaina
Period Open T.code: MMP1
Period Close T-Code: MMPV
Automate the opening of MM periods
How can you automate the monthly opening of MM periods (transaction MMPV - program RMMMPERI) with
SM36?
RMMMPERI accepts a period/year or a date.
If you enter a date the period is derived by it.
1. create a variant and check the attribute 'selection variable' for the parameter date. Then click the button 'Selection variables' and set the current date. Every time this variant is used the parameter DATE is filled with the current date.
2. create a job for RMMMPERI with the variant created in the preceding step. Set it as periodic.
If you're not using a fiscal year variant simply schedule it as monthly (to be executed the first day of the month).
If you are using a fiscal year variant you'd have to define a calendar with only the first day of each period defined as working
day and use it in the periodicity restrictions.
Another possibility:
Write a very simple ABAP which run daily to check if the period has changed and submit RMMMPERI.
Reward if useful to u -
How can I reference the last value in a column?
How can I reference the last value in a column? For example, today I want the value of A1 to appear in another cell. Tomorrow, I will add a row and want to reference A2, next day A3, and so forth.
Now I got it:
=OFFSET(A1,COUNT(A)-1,0) -
How to calculate YTD and Last year YTD on Date in Bex
Hi,
I have a requirement in which I need to show the report as following format.
I need to show Year>monthday as Hierarchy. user will drill down on Month to Date.
Del Qty Ord Qty Del Qty LY Del Qty YTD Del Qty L YTD
Year
> Drill Down to Months
Jan
Feb
Mar
---> 1.03.2010
---> 2.03.2010
---> 3.03.2010
Dec
I have Calday, Calmonth, Calyear all three objects.
Now my question is how I can achive this? On which i need to create hierarchy?
and how to calculate the YTD at day level.
Note:- in the selection calyear is mandatory. User wants to display as per year. So What infoobject I need to take in selection?
and the way to calculate YTD on Day (in the case also ,where user doesn't give the date in selection)
Plz reply asap its uregent !!!
Thanks in advance,
AmitHi,
As per my understanding I think YTD means JAN to current date result. I means say if user enter 062005 then result in YTD should be from 012005 to 062005.
And to do this you need to write a customer exit variable where LOW field of internal table you will put JAN year and HIGH will contain month year entered by user.
Hope this will help you.
Suneel -
How to calculate the total running time for process from sysssislog entries
Hi All,
I have the below query which gets me the log entries form the logs table when the process started/completed.
Select row_number() over (order by starttime) row_num,Substring( Substring(message, CharIndex('''',message) +1 ,Len(message)) ,0, CharIndex('''',Substring(message, CharIndex('''',message) +1 ,Len(message)))) as Description,
starttime,endtime,message
from dbo.sysssislog
where (message like 'start%' or message like 'finish%' ) and
LEFT(Substring( Substring(message, CharIndex('''',message) +1 ,Len(message)) ,0, CharIndex('''',Substring(message, CharIndex('''',message) +1 ,Len(message)))),1) between 'A' and 'Z'
order by starttime
However,I have to build a report on the top of it showing how much time that attribute/dimension/heirarchy took to execute(Ex-How much time did YearlyReview dimension take to complete).I dont have much knowledge of T-SQL and unable to figure out how to calculate
that on SQL or report level.
Could someone please assist me in getting the exact query for that?
Thanks a lot.I get the below output(sample 20 rows) on executing this query.Also,a start process does not necessarily follow up a finished message for the same dimension as it may have been stopped or it failed.So we need to leave it as NA in case it started but dint
finish
Row_Num Description starttime endtime Message
1 PAC SC Super Type 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC SC Super Type' dimension.
2 PAC SC Super Type 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC SC Super Type' dimension.
3 Team Member Indicator 12/13/12 16:38 12/13/12 16:38 Started processing the 'Team Member Indicator' dimension.
4 Team Member Indicator 12/13/12 16:38 12/13/12 16:38 Started processing the 'Team Member Indicator' dimension.
5 PAC SC Super Type 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'PAC SC Super Type' attribute.
6 PAC SC Super Type 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'PAC SC Super Type' attribute.
7 Specialist Merger Indicator 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'Specialist Merger Indicator' attribute.
8 Specialist Merger Indicator 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'Specialist Merger Indicator' attribute.
9 YearlyReview 12/13/12 16:38 12/13/12 16:38 Started processing the 'YearlyReview' dimension.
10 YearlyReview 12/13/12 16:38 12/13/12 16:38 Started processing the 'YearlyReview' dimension.
11 PAC SC Repeat Caller 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC SC Repeat Caller' dimension.
12 PAC SC Repeat Caller 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC SC Repeat Caller' dimension.
13 Year 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'Year' attribute.
14 Year 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'Year' attribute.
15 Staffing Function 12/13/12 16:38 12/13/12 16:38 Started processing the 'Staffing Function' dimension.
16 Staffing Function 12/13/12 16:38 12/13/12 16:38 Started processing the 'Staffing Function' dimension.
17 PAC SC Repeat Caller 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'PAC SC Repeat Caller' attribute.
18 PAC SC Repeat Caller 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'PAC SC Repeat Caller' attribute.
19 PAC HV Cust 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC HV Cust' dimension.
20 PAC HV Cust 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC HV Cust' dimension. -
How to calculate the Percent change in a dynamic
hi All,
I'm trying to get the percent increase/change of two dynamic
colums. In my report, the user has a checkbox where he can select two colums to calculate the percent growth.
My DataSet is PilarName, Calification(is a decimal value) and Period (this is a string). I created the Matrix this way:
PilarName [Period]
[PilarName] [Calification]
Which give me these values:
So, now I need to create another column to calculate the percentage change between these two colums. I tried this:
I added a Adjacent column group for Period column and I grouped by the calculated column "ColumnDiff". Add the following expression.
=(SUM(Fields!Calificacion.Value)- Previous(SUM(Fields!Calificacion.Value),"ColumnDiff"))/Previous(SUM(Fields!Calificacion.Value),"ColumnDiff")
After that I get:
I'm getting the sum of the two columns instead.
Any clue about what I'm doing wrong? Please help me, I've been looking for the answer but any solution works for me.
Luis CarlosHi Luis,
According to your description, you have a report with different dynamic columns. Now what you want is show your user percentage growth in your matrix report after your user select two of those columns (I think you may use parameter to achieve your “checkbox”
function). Is my understanding correct?
In Reporting Service, we can’t calculate dynamic columns with our build-in arrogation functions. So we need to add custom code into our report, and call those functions which defined in custom code in our expression. We have tested your scenario in our local
environment. Here are steps and screenshots for your reference.
Go to your Report Properties, add the custom code below into your report:
Dim Shared Num1 As Double
Dim shared Num2 As Double
Public Function GetCalification(Calification as Double,Type as String,Type2 as String)
If Type = Type2 Then
Num1=Calification
Else
Num2=Calification
End If
Return Calification
End Function
Public Function GetPec()
Return (Num2-Num1)/Num1
End function
Create a matrix. Put PilarName into Row field, put Period into Column field. In Data field, put the expression below into the textbox:
=Code.GetCalification(Fields!Calification.Value,Fields!Period.Value,Parameters!Period.Value(0))
In our sample report, we created a parameter (named Period) for selecting two columns. You can replace “Parameters!Period.Value(0)” with your own parameter.
Add an outside column at right (%Growth), put the expression below into the textbox:
=Code.GetPec()
Save and preview. The matrix and result looks like below:
Reference:
Custom Code and Assembly References in Expressions in Report Designer (SSRS)
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
How to calculate percentge based on totals of two columns?
All,
I am trying to create a percentage in the totals of a worksheet.
PCT = (AMT01 / AMT02) * 100
GTPCT = (AMT01 / ( SUM(AMT01) OVER (PARTITION BY COL01))
AMT02 will be hidden
PCT will not be totaled, since the total is not correct.
GTPCT will be formatted to blend display with background to hide value, but the total will be displayed.
Here is an example:
Page Item: COL01: A
...........................(Hidden)
COL02....AMT01....AMT02....PCT....GTPCT
A...........10..........8............125.....16.39 hide using format
B...........15..........14..........107.....24.59 hide using format
C...........9............6............150.....14.75 hide using format
D...........21..........18..........117.....34.42 hide using format
E...........18..........15..........120.....29.50 hide using format
Totals:....73..........61....................120
My problem is when I create the GTPCT calculation I get the correct values, but the Total does not display. I am using 10.1.2.54.25 CP4 at the moment. Does anyone have any thoughts on why Discoverer chooses not to recognized GTPCT calculation as a column that can be totaled? Does anyone have a better idea on how to accomplish my objective?
On another note... How do you format in this forum for proper displaying?
Thanks,
Jamie
Edited by: jmdavis on Oct 7, 2008 7:45 AM
Edited by: jmdavis on Oct 7, 2008 7:46 AMOK... I solved it myself. For whatever reason it just wouldn't work. So I rebuilt the workbook / worksheet from scratch using CELL SUM in my totals for the GTPCT column.
-
How to activate the option posting period for T.code F.2E
HI All,
When we execute T.code F.2E the selection parameters available are
1. company code
2. partner company code
3. open at key date
4. display currency.
As the program documentation says we can reconcilie by selecting option for posting period in F.2E
Below is the SAP documentation on the program.
You use the Posting period selection option to specify the time period in which the posting dates of the documents need to fall in order to be included by the program. Open items, cleared items, and payment documents are all selected. See the section Parameter Open for key date and Selection Option Posting period for further information. If you want to start the program with this date selection, the option must be selected accordingly.
But the field for posting period is not available in selection parmeter, we are on 4.7 EE version.
Please let me know how to activate the option for posting period in selection parameters for T.code F.2E
Thanks in advace.
Regards,
Raj.Hi,
I have tried to execute the program FBICRC003_DATA_REC. But program doesn't exist.
We are on 4.7 version. I have executed program RFICRC00, but stil can't find the option posting period.
Please confrim.
Thanks
Regards,
Raj.
Edited by: Raj Racha on Dec 27, 2010 10:58 AM -
How to calculate total no of days in List column
Hi,
I've start date and end date. Can you please help me how to calculate total number of days.
Column Name = Leave Start Date (05/02/2015)
Column Name = Leave End Date (19/02/2015)
Column Name = Total Days (This is calculated column)
I used below formula but its showing only 14 days however it should show 15 days
=DATEDIF([Start Date], [End Date],"d")
Thanks,I got the answer
Formula is
=DATEDIF([Start Date], [End Date]+1,"d")
Thanks.:) -
How to open again the past period for Material?
Hi All,
by t.code MMPV, I can close a period for Material.
I wonder if is possible to turn back.
Thankshi
If you want to open previous period for reversal entry or additional entry
The following are steps for Opening previous period in MM :
1. Go to TCode SU01 (see OSS NOTES 487381)
2. Choose "change" tab with your loging Name
3. Choose "Parameter" tab
give Parameters MMPI_READ_NOTE with date format as YYYYMMDD
(say today 20100302)
4. SAVE.
5. Go to T-code MMPI
6. open the old periods which you want to post into,
Note :
the period opening will be valid for only for the particular day only.
7. Complete the posting you want to reverse or add
8. Go to MMPV to close the periods
Note :
If we enter the date or month in MMPV means we are opening that date or month by closing previous date or month
(Never use MMPV without completing the transaction in previous month)
POSTING ENTRY INPAST PERIOD IS NOT RECOMENDED check note 487381 -
How to pass more than one value for one column in procedure
hi
select id, name from col_tab where dept_name in ('ECE','CIVIL');
when i was running this it is working well.
CREATE OR REPLACE PACKAGE pack_str
AS
TYPE type_refcur IS REF CURSOR;
PROCEDURE str(char_in VARCHAR2,ans OUT type_refcur);
END pack_str;
CREATE OR REPLACE PACKAGE BODY pack_str
AS
PROCEDURE str(char_in VARCHAR2,ans OUT type_refcur)
IS
BEGIN
OPEN ans FOR
select id,name from col_tab where dept_name in char_in ;
END str;
END pack_str;
the package was created.
my doubt is
1.how to pass more than one value for char_in (e.g ('ECE','CIVIL'))
2. when i was storing the value in string like val = 'ECE,CIVIL' ,
how to get the id,name for ECE and CIVIL.
plz help meHi Rebekh ,
I am recreating your packages for the desired output.
CREATE OR REPLACE PACKAGE pack_str
AS
TYPE type_refcur IS REF CURSOR;
PROCEDURE str(char_in VARCHAR2,ans OUT type_refcur);
END pack_str;
CREATE OR REPLACE PACKAGE BODY pack_str
AS
PROCEDURE str(char_in VARCHAR2,ans OUT type_refcur)
IS
lv_t varchar2(200);
BEGIN
lv_t := REPLACE(char_in,',',''',''');
lv_t := 'select id,name from col_tab where dept_name in (''' || lv_t || ''')' ;
OPEN ans FOR lv_t;
END str;
END pack_str;
Note:-
Input Parameter char_in is a comma seperated value for dept_name
-Debamalya -
How to get difference between two rows for a column field?
hi, all,
Could anyone show me what query statement is to get the difference betweem two rows for two column fields?
The tables and its records are like this:
id, begin, end
p1 21 30
p2 45 60
p3 120 150
I would like to have the query result like this
id, diff
p1 15 --- which is 45 minus 30
p2 60 --- which is 120 minus 60
and so on...
thank you in advance.
RaffyYou can use the LAG function to access values from previous rows:
with q as (select 'p1' id, 21 v_start, 30 v_end from dual
union all
select 'p2', 45, 60 from dual
union all
select 'p3', 120, 150 from dual)
select id, v_start, v_end, v_start - lag (v_end, 1, 0)
over (order by id) v_diff from q
ID,V_START,V_END,V_DIFF
p1,21,30,21
p2,45,60,15
p3,120,150,60
See the SQL Language doc
http://docs.oracle.com/cd/B28359_01/server.111/b28286/functions075.htm -
How to get the NameTab Structure(X031L) for Dynamic internal table?
when we pass standard table to the FM 'DD_GET_NAMETAB' we will get the
nametab structure(x031l), like this i want to get the same structure for
dynamic internal table . how can I achieve this
please help me...Hi,
try this method
REPORT zmaschl_create_data_dynamic .
TYPE-POOLS: slis.
DATA: it_fcat TYPE slis_t_fieldcat_alv,
is_fcat LIKE LINE OF it_fcat.
DATA: it_fieldcat TYPE lvc_t_fcat,
is_fieldcat LIKE LINE OF it_fieldcat.
DATA: new_table TYPE REF TO data.
DATA: new_line TYPE REF TO data.
FIELD-SYMBOLS: <l_table> TYPE ANY TABLE,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
Build fieldcat
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' EXPORTING i_structure_name = 'SYST' CHANGING ct_fieldcat = it_fcat[]. LOOP AT it_fcat INTO is_fcat WHERE NOT reptext_ddic IS initial. MOVE-CORRESPONDING is_fcat TO is_fieldcat. is_fieldcat-fieldname = is_fcat-fieldname. is_fieldcat-ref_field = is_fcat-fieldname. is_fieldcat-ref_table = is_fcat-ref_tabname. APPEND is_fieldcat TO it_fieldcat. ENDLOOP.
Create a new Table
CALL METHOD cl_alv_table_create=>create_dynamic_table EXPORTING it_fieldcatalog = it_fieldcat IMPORTING ep_table = new_table.
Create a new Line with the same structure of the table.
ASSIGN new_table->* TO <l_table>.CREATE DATA new_line LIKE LINE OF <l_table>.ASSIGN new_line->* TO <l_line>.
Test it...
DO 30 TIMES.
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
<l_field> = sy-index.
INSERT <l_line> INTO TABLE <l_table>.
ENDDO.
LOOP AT <l_table> ASSIGNING <l_line>.
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
WRITE <l_field>.
ENDLOOP. -
How does one give out enough spaces for a column in SQL report ?
How does one reserve enough spaces for a column in SQL report ?
Ex: 2 columns defined as the following
projectNo varchar2(10)
ProjectName varchar2(50)
When create an sql report, the report heading will show below. If my project name is " Tire Strength Test At Site R987654" . I need to get it to show in one line since it was defined as varchar2(50)
projectNo ProjectName
A0001 Tire Strength
Test At Site
R987654 There got to be a way to get around here . Thanx in advance.
taiI noticed the CSS Style settings only seem to work if using a "Standard Report Column". Unfortunately I have the need to define some report columns where undesired wrapping occurs as "Display as Text (based on LOV, does not save state)" and tried to avoid wrapping, but no luck - is there a way around this (other than performing the report query using a huge DECODE clause, which somewhat renders the LOV useless except for data entry)?
Thanks in advance for any ideas,
Holger -
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;
Maybe you are looking for
-
How can I restrict certain apps to cellular data only?
Product Name: iPhone 6 Product iOS: 8.3 Background: I listen to Pandora at work through my iPhone 6. My work has pandora traffic blocked through their WiFi network. I want to keep my iPhone connected to the work WiFi because 1) I don't want to turn o
-
How can i create an itunes u site for UAE university? Plz help
Dear, I live in DUBAI - UAE, and we need to creat a itunes u site for our university. It is one of the largest universties of the region. But when i go to create a site, in country list i don't find name list of limited countires, and UAE isn't there
-
HI friends, I need the xslt mapping code for the following input. my input is i a have different fields in employee table in source side i need all the source fields bonded into a single string i target side.please send me the code i
-
Can anyone see in this code why my insert and check username function is not working?
Hi guys. I have an error that has me stumped. I have a form that inserts text from a text field into a mysql database and I have added a check user name function to check if this number already exists. Here's the page http://www.thechallenge.net.au/r
-
Dear All, When we mapped a table control to the data base table the standard f4 help for the fields is automatically comes for the respective fields in the table control. Now my requirement is to make my own F4 help for the field in a table control.