Current week -1 and last 9 weeks
Hi,
I want to show the fiscal weeks in x-axis like
(current_week) - last 9 weeks only
Thanks
Edited by: 806756 on Feb 6, 2013 10:21 PM
Hi,
Try to use below formula,
Formula for the last week:
FILTER("Presentation Folder"."# of opportunities" USING ("Time"."Day" > TIMESTAMPADD(SQL_TSI_WEEK,-1,CURRENT_DATE)))
Formula for the last two weeks:
FILTER("Presentation Folder"."# of opportunities" USING ("Time"."Day" > TIMESTAMPADD(SQL_TSI_WEEK,-8,CURRENT_DATE)))
Or,
Apply the below code in filter condition.
Select operator is between then apply the below conditions.
TIMESTAMPADD(SQL_TSI_WEEK,-1,CURRENT_DATE)
TIMESTAMPADD(SQL_TSI_WEEK,-9,CURRENT_DATE)
Hope this help's
Thanks
Satya
Similar Messages
-
How to calculate start date and last date for current week
Dear All.
i want to calculate the start of the current week as well as the last date of the current week, our week start from Saturday and ends of Friday i.e. Saturday is the first day of the week and Friday is the last day of the week.
How can i acheive this in universe Designer?.
Please help...Hi
the formulas in webi will be as follows
for startdate
=RelativeDate(LastDayOfWeek(CurrentDate());-8)
for enddate:
=RelativeDate(LastDayOfWeek(CurrentDate());-2)
Regards,
Ranganath -
How to get data for current week and previous week using customer exit in Bex.
Hi everyone,
I have a scenario in which I need to display data for current week and previous week (based on "sy_datum" the program has to calculate current week and previous week) in Bex using Customer exit. I have created one variable in Bex Query Designer and I have written code for the variable in CMOD. But it is not working fine, (I know that we can do the same by using offset value in Bex). Can some one guide me how to achieve my requirement using customer exit.
Thanks in Advance,
G S Ramanjaneyulu.Hi krishna,
Thanks for your quick reply, can you have a look at my code,
case i_vnam.
WHEN 'ZPWK_CWK'.
ranges : pre_week for sy-datum.
data : start_date type DATS,
end_date TYPE dats .
************FM TO GET FIRST DATE OF CURRENT WEEK ************************
CALL FUNCTION 'BWSO_DATE_GET_FIRST_WEEKDAY'
EXPORTING
DATE_IN = sy-datum
IMPORTING
DATE_OUT = start_date. " WEEK FIRST DATE
end_date = START_DATE + 6. " WEEK LAST DATE
END_DATE = START_DATE - 1. " PREVIOUS WEEK END DATE
START_DATE = START_DATE - 7. " PREVIOUS WEEK START DATE
**********PREVIOUS WEEK DATES IN PRE_WEEK******************
pre_week-SIGN = 'I'.
pre_week-option = 'BT'.
pre_week-LOW = START_DATE.
pre_week-HIGH = END_DATE.
APPEND pre_week.
CLEAR : START_DATE,END_DATE.
endcase.
Regards,
G S Ramanjaneyulu. -
Current date, first day of month, last day of month, current week, current
Hi All,
may be the question will sounds basic for your guys, I am connecting via MDX a cognos reportnet on a BW 3.0B..due to loads of limitations on filtering via MDX on 'business date/time functions' , I would need to create in the infoqueries that are my data sources, the following additionnal objects:
- current date
- first day of current month
- last day of current month
- current week
- current year
I do not want prefiltered infoqueiries but object with these single values so that from reportnet I can have something like: OCALDAY between 'first day of current month' and 'last day of curent month'
Is there standard fonction for this under BW/BEX or if we need to developp functions has nayone some code examples.
thanks a lot for your great input
DavidHi,
In universe level if you want implement the requirede functions then you have to write custom sql and if you want to implement them in Reporting level then most of the functions are available to you. e.g. Quarter,Month, Year, Current Date....
Cheers,
Suresh A. -
Getting first and last day of week
Dear all .
Is there any funcion module which gives first and last day of the current week .
Eg . todays day is 15.11.2006
start date of week : 13.11.2006
end date of week : 19.11.2006
in the same way I want how many days are there in month .
Eg : for Nov month :
30 days .
for dec month 31 days .
Thank you in advanceUse FM GET_WEEK_INFO_BASED_ON_DATE
Import parameters Value
DATE 15.11.2006
Export parameters Value
WEEK 200646
MONDAY 13.11.2006
SUNDAY 19.11.2006
Use FM HR_E_NUM_OF_DAYS_OF_MONTH
Import parameters Value
P_FECHA 15.11.2006
Export parameters Value
NUMBER_OF_DAYS 30
I hope it helps.
Best Regards,
Vibha
*Please mark all the helpful answers -
How to find first and last date of a fiscal week using SQL
Hello,
I want information about FISCAL Week, means a Week based on ISO standard. I know format strings ‘IW’ or ‘IYYY’ gives fiscal week and fiscal year respectively from a given date. But I want to find the first and last date of a fiscal week. Say suppose I have a fiscal week is 2, and fiscal year is 2008, how to find the start and end date of the given fiscal week.
Any kind of help would be greatly appreciable.
Thanks,
Princedavide gislon wrote:
The following query evaluate the begin of a fisical week, where &year and &week are respectively the year and week you want to calculate.
To evaluate the end of the week you have to add 6.
Note that my database is set to have monday as day number 1 of the week, and sunday as day number 7; if your database settings are different you should modify the query accordingly.
SELECT CASE TO_CHAR(TO_DATE('&year','YYYY'),'D')
WHEN '1' THEN TO_DATE('&year','YYYY')+((&week-1)*7)
WHEN '2' THEN TO_DATE('&year','YYYY')+((&week-1)*7-1)
WHEN '3' THEN TO_DATE('&year','YYYY')+((&week-1)*7-2)
WHEN '4' THEN TO_DATE('&year','YYYY')+((&week-1)*7-3)
WHEN '5' THEN TO_DATE('&year','YYYY')+((&week-1)*7+3)
WHEN '6' THEN TO_DATE('&year','YYYY')+((&week-1)*7+2)
WHEN '7' THEN TO_DATE('&year','YYYY')+((&week-1)*7+1)
END BEGIN_FISICAL_WEEK
FROM DUAL
Hope this is helpful.
Cheers,
Davide
Edited by: davide gislon on 08-Jan-2009 07:19Your query does nothing you say it does. TO_DATE('&year','YYYY') returns first day of the current month for year &year. And the only reason it returns January 1, &year is that we are currently in January:
SQL> select TO_DATE('&year','YYYY') from dual
2 /
Enter value for year: 2005
old 1: select TO_DATE('&year','YYYY') from dual
new 1: select TO_DATE('2005','YYYY') from dual
TO_DATE('
01-JAN-05
SQL> As soon as we roll into February:
SQL> alter system set fixed_date = '2009-2-1' scope=memory
2 /
System altered.
SQL> select sysdate from dual
2 /
SYSDATE
01-FEB-09
SQL> select TO_DATE('&year','YYYY') from dual
2 /
Enter value for year: 2005
old 1: select TO_DATE('&year','YYYY') from dual
new 1: select TO_DATE('2005','YYYY') from dual
TO_DATE('
01-FEB-05
SQL> alter system set fixed_date = NONE scope=both
2 /
System altered.
SQL> select sysdate from dual
2 /
SYSDATE
08-JAN-09
SQL> But even if TO_DATE('&year','YYYY') would always return January 1, &year, or you would fix it to TO_DATE('0101&year','MMDDYYYY') it still would be wrong. ISO week rules are
If January 1 falls on a Friday, Saturday, or Sunday, then the week including January 1 is the last week of the previous year, because most of the days in the week belong to the previous year.
If January 1 falls on a Monday, Tuesday, Wednesday, or Thursday, then the week is the first week of the new year, because most of the days in the week belong to the new year.Therefore, next year:
SQL> DEFINE YEAR=2010
SQL> DEFINE WEEK=1
SQL> ALTER SESSION SET NLS_TERRITORY=GERMANY -- enforce Monday as first day of the week
2 /
Session altered.
SQL> SET VERIFY OFF
SQL> SELECT CASE TO_CHAR(TO_DATE('0101&&year','MMDDYYYY'),'D')
2 WHEN '1' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7)
3 WHEN '2' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7-1)
4 WHEN '3' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7-2)
5 WHEN '4' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7-3)
6 WHEN '5' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7+3)
7 WHEN '6' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7+2)
8 WHEN '7' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7+1)
9 END BEGIN_FISICAL_WEEK
10 FROM DUAL
11 /
BEGIN_FI
04.01.10
SQL> SELECT TRUNC(TO_DATE('0101&&year','MMDDYYYY'),'IW') FROM DUAL
2 /
TRUNC(TO
28.12.09
SQL> 2 user10772980:
Use:
SELECT TRUNC(TO_DATE('0101&&year','MMDDYYYY'),'IW') + (&&week-1)*7 FISCAL_YEAR_&&YEAR._WEEK_&&WEEK
FROM DUAL
FISCAL_YEAR_2010_WEEK_1
28.12.09
SQL> SY. -
Get the Current Quarter and Current Week from date
Hi,
I want to get the Current quarter and Current week from a given date, which function modules should i use?
I tried using function module - 'HR_99S_GET_QUARTER' for getting the quarter but it is throwing an error while loading data. Moreover it doesnt exist in BI7.
Similarly for current week.
Please help. Sample code snippets would be appreciated.
Thanks
JayaYou can use FORM time_conversion wich is the one used by standard in Update Rules:
You can select whether convert 0CALDAY to 0CALWEEK or whatever infobject formats you prefer...
perform time_conversion
using '0CALDAY'
'0CALMONTH'
p_input_date
l_fscvtval
changing RESULT
c_t_idocstate
c_subrc
c_abort.
if c_subrc <> 0 or c_abort <> 0.
exit.
endif.
form time_conversion
using i_timnm_from type rsiobjnm
i_timnm_to type rsiobjnm
i_timvl
i_fiscvarnt type t009b-periv
changing e_timvl
c_t_idocstate type rsarr_t_idocstate
c_subrc like sy-subrc
c_abort like sy-subrc. "#EC *
data: l_timvl type rsd_chavl,
l_result type rsd_chavl.
IF i_timvl CO ' 0'.
CLEAR e_timvl.
EXIT.
ENDIF.
l_timvl = i_timvl.
CALL FUNCTION 'RST_TOBJ_TO_DERIVED_TOBJ'
EXPORTING
i_timnm_from = i_timnm_from
i_timnm_to = i_timnm_to
i_timvl = l_timvl
I_FISCVARNT = i_fiscvarnt
I_BUFFER = rs_c_true
IMPORTING
E_TIMVL = l_result
EXCEPTIONS
INCOMPATIBLE_TOBJS = 1
NO_INPUT_VALUE = 2
FISCVARNT_MISSING = 3
INPUT_NOT_NUMERIC = 4
WRONG_DATE = 5
WRONG_FISCPER = 6
X_MESSAGE = 7
OTHERS = 8
e_timvl = l_result.
ENDFORM. "TIME_CONVERSION -
Report Issue: Previous Weeks, Current Week and Next Week Values
Hello Folks,
this is a typical requirement...at-least typical for me..
we have 20 weeks of data at weekly level. we have four Metrics out of which two are coming from Database and rest two are calculated metrics.
Metric0: On Hand Qty
Metric1: Past Qty
Metric2: sell Qty
Metric3: unsell qty
Metric4: Total Qty
the report will always be shown for 20 weeks, but depending on whats my current week, all the past weeks should be flagged as Past Week. (so i wrote a case statement for this). for Instance: I am in Week11, so my weeks in should be Past Week, Wk11, Wk12.........Wk20.
Metric 1 is always dependent on result of Metric4 (This is the Complexity) per week basis
Metric1 for Past weeks value in Week Column will be wk1 to wk10 On Hand Qty (fox ex: 80)
Metric4 for Pass Weeks Value in Week Column will be Metric1 for Pastweeks + Metric2 for Past Weeks (For Ex: 20) (Past weeks mean wk1 to wk10)
value of Metric4 is now 100
Metric1 for Week11 Now should 100 (From Past weeks Calculation)
Metric4 for Week11 will be Metric1 for Week11(100) + Metric2 for Week11(10) + Metric3 for Week11 (10)
Now...Metric1 for Week12 will be 120 which is wk11 total (100+10+10) and goes on Until Week 20
Any Ideas how to achieve this in obiee 10g
Thanks
RakePlease try out in this way....
Database level --Create opaque view & procedure or function to get the week total,week ago total, current week , Past week ,future week & do rpd modelling and use PIVOT VIEW.
At answers:
1.Here Previous week M4 is the current week M1 which means it is a cumulative value carried forward week by week.
2. M2 & M3 are direct database columns.
3. You have time hierarchy with WEEK Level.
M1 - ago(rsum(m2+m3),weeklevel)
M4- RSUM(M2+M3)
week -AGO(RSUM(M2+M3)- M2-M3-RSUM(M2+M3)
w1-0-10-20-30
w2-30-11-21-62
w3-62-12-22-96
Now you can PIVOT IT to get in
W1-W2-W3
M1 0 - 30-62
M2 10-11-12
M3 20 -21-22
M4 30 - 62-96
NOW PASTWEEK (W1-W10), CURRENT WEEK(W11)-W12
1.as you see cumulative here you need to use BINS.means ( case when week <= currentweek(maybe variable) then prior) else week)
2. UNION - combine similar request - First cirteria week <= w11 and second criteria week > week 11 --combine pivot it. Use sum agg in fx criteria1.
Hope this should solve your pblm at answers.
Edited by: MK on Oct 27, 2011 12:48 PM -
How to get Current week and No of Weeks for each quarter!!
Hi,
As a part of report development I have to derive Current week and No.of Weeks in Curreny Query. Based on these information I have to calculate Phased target (Calculated KYF).
Phased target = (Target for Quarter / No of weeks in Current Quarter) X Current Week.
We have to derive Current Quarter and Current week from Customer Exit (From Invoice date, which is an entry by Users at report level).
My questions are:
1) We have to derive Two Restricted key figures (by Calweek) for derving No of weeks for Currnet Quarter and Current week in Query level. Based on this info, we have to derive Calculated kef figure for Phased target.
2) And the output is 6 (ex:- 132008) char length for Current week and we have to pick Week info only and we have to populate RKF created for Current week. How we can achieve this.
3) Regarding the No of weeks per for current quarter, we are writing Customer exit to determine Quarter and no of weeks, but how to bring this info in query level.
4) Is there any standard code available (SAP Exit) to find Current week and No of Weeks in Current quarter.
Regards,
Suresh MolliHi Venkat Molli,
Follow the below step for the doing the same:
1. Create a customer exit variable on calweek.
2. Restrict the created variable for respective info object.
3. To Populate the data write code in CMOD.
in enhancement function module: EXIT_SAPLRRS0_001 -> in Include ZXRSRU01 write the below code:
WHEN '<variable name>'.
IF i_step = 1.
CLEAR l_s_range.
CALL FUNCTION 'RSVAREXIT_0P_CWEEK'
IMPORTING
e_t_range = lt_week.
READ TABLE lt_week INTO l_s_range1 INDEX 1.
v_last_week = l_s_range1-low+4(2).
v_last_week = v_last_week - 1.
l_s_range1-low+4(2) = v_last_week.
l_s_range-low = l_s_range1-low.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ENDIF.
4. Execute the report.
I hope you can handle you issue now.
Assign points if it is helpful.
Regards,
S P. -
Get the current week and subtract 12 weeks
Hi Experts,
Am getting the system current date and getting the current week using the FM->GET_WEEK_INFO_BASED_ON_DATE. Again I want to subtract 12 weeks including the current week. But still confused with the logic.
Also I came to know that I can use FM->DATE_GET_WEEK and can subtract 12 weeks from it.
So please advice how can I proceed further and how can I get the weeks that should be lesser than the 12weeks from the current week.
Waiting for your valuable ideas.:)
Thanks and Regards,
Ramakrishnan MTry this one:
DATA: week TYPE numc1,
days TYPE t5a4a-dlydy,
date TYPE p0001-begda,
months TYPE t5a4a-dlymo,
years TYPE t5a4a-dlyyr.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = s_ord_dt-low
days = days
months = months
signum = '+'
years = years
IMPORTING
calc_date = date. -
Hi there
Hope someone can help me here. I am currently on holidays and my
Kids have disabled my iPad so I now have to sync with my computer.
I don't have my computer handy and want to use my device over the next few weeks
if possible so can anyone help me please
Thanks
Darren
iPad 2 Wi-Fi + 3G, iOS 6.0.2You need a computer.
Suggest you goto the nearest Apple Reseller and ask them to help you. -
Store value less than current week and year.
Hi All,
I have a table called BACKLOG whose structure is like this
ITEM_NUMBER YEAR_WEEK MS
1N58 2012-WK02 01/15/2012
1N58 2011-WK02 01/15/2011current from my procedure i am storing the value in my new table which is less than current week. But i want to store the value less than current week and current year. Please help me to get how i can do this.
PROCEDURE BACKLOG_PROC_LT_CW IS
BEGIN
DELETE BACKLOG_LT_CW;
COMMIT;
INSERT INTO BACKLOG_LT_CW
SELECT
DC_UTIL.GEN_YEAR_WEEK(MS) YEAR_WEEK,
ITEM_NUMBER,
MSD
FROM BACKLOG
where to_char(MS, 'IW')<to_char(sysdate, 'IW');
END BACKLOG_PROC_LT_CW;Currently with the above procedure code both the value is storing in my BACKLOG_LT_CW table but if you see the data of BACKLOG table you will find YEAR_WEEk 2012-WK02 falls in next year but still it is storing in my table because i have taken IW only. Please help me to get the soln
Thanks in advance
RegardsAre you looking for this?
where to_char(MS, 'YYYYIW')<to_char(sysdate, 'YYYYIW'); -
Getting the exact date of current week and current month
I would like to know is there any methods to know the exact date of the current week and current month?
//use this function like this
//String date = getNow();
public static String getNow()
Calendar cal = new GregorianCalendar();
// Get the components of the time
int hour24 = cal.get(Calendar.HOUR_OF_DAY); // 0..23
int min = cal.get(Calendar.MINUTE); // 0..59
int sec = cal.get(Calendar.SECOND); // 0..59
// Get the components of the date
int year = cal.get(Calendar.YEAR); // 2002
int month = 1 + cal.get(Calendar.MONTH); // 0=Jan, 1=Feb, ...
int day = cal.get(Calendar.DAY_OF_MONTH); // 1...
String timeStamp = String.valueOf(year) + "-" + addZero(month)+ "-" + addZero(day)
+ " " + addZero(hour24)+ ":" + addZero(min) + ":"+ addZero(sec) + ".0";
return timeStamp;
public static String addZero(int num)//this function works with the getNow() function
//all it does is adds a zero to an int if its less then ten
String val = "";
if(num < 10)
val +="0"+num;
}else{
val = String.valueOf(num);
return val;
} -
Find the first and last day of week giving a certain date
Hi,
i have an application in wich the user puts a date, say today 2010-08-10 and i have to calculate first and last day of that week, in this case 2010-08-09 and 2010-08-15. How can i do this?
Many thanks in advance,
Nuno Almeidanfalmeida wrote:
i have an application in wich the user puts a date, say today 2010-08-10 and i have to calculate first and last day of that week, in this case 2010-08-09 and 2010-08-15. How can i do this?First step is being sure that you know what a 'week' is.
For example does it really start on monday? And will it always start on monday?
And what day does the 'week' end on for 2010-12-29? In some businesses it will end on 2010-12-31 (friday) -
How to derive Current week and Number of Weeks for present quarter.
Hi,
Currently we are developing a report on Actuals and Planned sales. We have two different data targets to hold these information.
CRM team will provide targets for BP monthly in CRM table, from where we are extracting the data into BW and report exection frequency is Daily.
Report Output format:-
1) Target1St Month in the quarter, Target2nd Month in the quarter, Target3rd Month in the quarter, Target Quarter, Month To date (Taget for Current month - Sales till today),
Let us assume we are Q1 and user executing this report on end of March Target1 = Jan, Target2 = Feb, Target 3 = March and Quarter target = Target1 + Target2 + Target 3.
We can achieve this by offset variables.
But if users are exectuing this report Apr (Q2) then Target1 = Apr target , target2 and target3 =0
Becoz we are in Q2 and first month of the quarter. If users are executing this report in May target1 should be Apr target and Target 2 = May target and Target3rd month should be Zero.
2) We have one keyfigure called as Quarter Phased Target = (Quarter target/ No of weeks in current quarter)* current week; For this we have to get No of weeks in every quarter and Curren week (when the reports get executed).
Let us assume we are executing this report on 25th jan and target for that month = 122units then Quarter phased target = [(122 + 0 (For Feb)+ 0 (For Mar) )/ 13] X4
4 is becoz we are in 4th in that quarter,
13 is becoz no of weeks in that quarter.
0 (For Feb) - Becoz we are in Jan only..
Hence please let me know how to get No of weeks in Current quarter and Current week for every quarter..
All the helpful answers will be awarded with full points.
Regards,
sureshhi,
For the first querry.
the problem is because u are using calmonth.
Instead of using cal month use fiscal period.
When u use fiscal period the data will be shown automatically for the Previous months using offsets.
u have to take taht in ur transformation and should map it to constant value depending on the fiscal periods of ur compnay?
march- apr,jan-dec etc.
for teh second querry there would be some charecteristic which might give data in weeks as well just check that and if availabe u can use it.
am not too sure abt it. -
I had a purchased an upgrade to lightroom 5 back in Dec and last week it disabled my use of develop module saying my trial has expired. On my account it says I purchased the upgrade and have a serial number. It is not giving me an option to enter serial number anywhere.
Lightroom doesn't launch or returns "Develop module is disabled" error after 5.5 update
Sign in, activation, or connection errors | CS5.5 and later
Mylenium
Maybe you are looking for
-
Unknown Album appearing in Album view
Hi, Minor frustration - in the 'Albums' view on my iPhone, a couple of 'Unknown Albums' appear - these are songs that have been stripped of their Album and Sort Album information, but which are still showing up under 'Albums'. They were purchased fro
-
Error in checking FORALL and FOR performance in PL/SQL.!
I am using FORALL and FOR construct' comparison in term of times taken by them(performance). This is whats my problem: SQL> SET SERVEROUTPUT ON; SQL> CREATE TABLE T1(C1 VARCHAR2(100)); Table created. SQL> declare 2 t1 number; 3 t2 number; 4 t3 number
-
Hi i am a beginner in Java. I was just trying out a UDP communication between a server and client. but what happens is that the server wait continuously but never receives the client's packet. Could some one help me out plz!! Thz !! CODE - THE CLIENT
-
Loading the last two versions of the ITunes software to my Dell computer has produced unacceptable results. None of the pull down menus are showing the menu choices and none of the content on my IPod Touch shows up in the appropriate window. As a r
-
Hi, I need a query to get a listing of all sales orders where the pricing has been changed from the approved price list. Also, a query to pull a list of changes to price tables that occurred in February, March, and June months of 2007. Can anyone hel