Getting previous weeks data based on parameters entered
I am using CRXI. I have a RT that gives me the current week data but I need to be able to report on previous week data based on the paraments so if I enter dates between sunday and saturday of one week it will report on those data plus the same days of the previous week. I looked at the lastfullweek function, but not sure how to implement it in my scenerio. any ideas?
Ralph
That worked, thankyou. My next question along the same lines, is I am also having a third column that will indicate the percent change. for example
Current Previous % Change
97 108
I am trying to computer the % change between curent and previous basically it would look at previous as being the control and computer positive or negative based on what current is. I can do the math formulas, but I'm not sure what to comute to find the % change.
Ralph
Similar Messages
-
FM to get previous sunday date based on current date(SY-DATUM)
hi all,
Is there any function module to get the previous sunday date based on current date(sy-datum)?
Regards,
Kapil SharmaHi Kapil,
You can follow the logic below:
data:
l_date like sy-datum, **TODAY
l_date2 like sy-datum, **Previous Sunday
data:
l_daynr like HRVSCHED-DAYNR.
*Get today's date
l_date = sy-datum.
*Gey today's day (Monday, Tuesday, etc.)
CALL FUNCTION 'HRIQ_GET_DATE_DAYNAME'
EXPORTING
langu = 'EN'
date = l_date
IMPORTING
daynr = l_daynr.
CASE l_daynr.
*If it is Monday
WHEN 1.
-Subtract 2 days for the previous Sunday
CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
EXPORTING
id_date = l_date
id-operator = '-'
is_duration = 2
IMPORTING
ed_date = l_date2.
*If it is Tuesday
WHEN 2.
CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
EXPORTING
id_date = l_date
id-operator = '-'
is_duration = 3
IMPORTING
ed_date = l_date2.
*If it is Wednesday
WHEN 3.
CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
EXPORTING
id_date = l_date
id-operator = '-'
is_duration = 4
IMPORTING
ed_date = l_date2.
*If it is Thursday
WHEN 4.
CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
EXPORTING
id_date = l_date
id-operator = '-'
is_duration = 5
IMPORTING
ed_date = l_date2.
*If it is Friday
WHEN 5.
CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
EXPORTING
id_date = l_date
id-operator = '-'
is_duration = 6
IMPORTING
ed_date = l_date2.
*If it is Saturday
WHEN 6.
CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
EXPORTING
id_date = l_date
id-operator = '-'
is_duration = 7
IMPORTING
ed_date = l_date2.
*If it is Sunday
WHEN 7.
CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
EXPORTING
id_date = l_date
id-operator = '-'
is_duration = 8
IMPORTING
ed_date = l_date2.
ENDCASE.
Regards,
Dilek -
FM to get the previous sunday date based on current date(sy-datum)
hi all,
Is there any function module to get the previous sunday date based on current date(sy-datum)?
Regards,
Kapil Sharma
Moderator Message: Basic date related questions are not allowed
Edited by: Suhas Saha on Sep 19, 2011 11:39 AMHi,
There are function modules to find out the current day of the week depending on sy-datum. These are as below:
1. DATE_COMPUTE_DAY - Returns a number indicating what day of the week the date falls on. e.g. Monday is returned as a 1, Tuesday as 2,...., Sunday as 7.
2. RH_GET_DATE_DAYNAME - Returns the day based on the date provided, e.g. Monday, Tuesday,..., Sunday.
Using any of the above, if you can find out the current day, then you can calculate and compute the date of the previous Sunday.
My observation is that using the first FM might make the calculation simpler.
Hope this is of help to you.
Regards,
Shayeree -
Hi all,
In my query user want to compare this week data verses previous week data. How can I get data which are there in previous week.
I donu2019t have loading date in my info provider.
Please suggest.Hi,
See the Customer Exit Code, you need have only 0CALDAY incube you can get the data.
ZCDAY = Use input Variable on 0CALDAY
ZFDFW & ZLDFW are Customer Exit variables on 0CALDAY.
To Get the First day of First Week in given Date
WHEN 'ZFDFW'.
DATA: zdf1 TYPE sy-datum,
zldate TYPE sy-datum,
zday(2) TYPE n,
zmnth(2) TYPE n,
zyear(4) TYPE n.
zday(2) = '01'.
LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZCDAY'.
CLEAR l_s_range.
zmnth = loc_var_range-low+4(2).
zyear = loc_var_range-low+0(4).
CONCATENATE zyear zmnth zday INTO zdf1.
l_s_range-low = zdf1.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
CLEAR l_s_range.
ENDLOOP.
To Get the Last day of First Week in given Date
WHEN 'ZLDFW'.
zday(2) = '07'.
LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZCDAY'.
CLEAR l_s_range.
zmnth = loc_var_range-low+4(2).
zyear = loc_var_range-low+0(4).
CONCATENATE zyear zmnth zday INTO zdf1.
l_s_range-low = zdf1.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
CLEAR l_s_range.
ENDLOOP.
Note: In this way you need to calcukate, here I'm dividing the month into weeks based on 7 days this is my company policy, so you need to check with your Functional team how they divides a week in a month.
Thanks
Reddy -
Hi all
Please help in writing a query to get the previous week data.
If the input date is sysdate then it should return values for previous week Monday to Sunday.
Whatever the input it should get the value for previous week from Monday to Sunday.
Thanks
JoIW is the formatter for the "Iso-Week"
ISO = international standard organization
See also: http://en.wikipedia.org/wiki/ISO_week
Main thing is that it will always start with monday. The weeknumber might be different then for ww format. This doesn't matter in your case. But you migh want to do some experiments with to_char(sysdate,'IW'), to_char(sysdate,'WW').
Trunc(<datevale>,'IW') will cut the date back to the first day of this iso-week.
select to_char(sysdate-365,'IW') IW , to_char(sysdate-365,'WW') WW from dual;
IW WW
37 36Edited by: Sven W. on Sep 9, 2010 2:29 PM -
Could not get Previous Week Day starting today
I need help to get PREVIOUS WEEK day starting today.
Eg:
Today is 15 / 09 / 2011
I need Date 08 / 09 / 2011
Hence both 15th and 08 are Thursday. One is today's thursday and other is previous week thursday.
RegardsWarranty on iPhone is not international, but valid only in country of
original sale. Since you purchased the iPhone in Australia, your warranty
is valid only in Australia. You must either personally return the iPhone
to Australia for evaluation and possible replacement or sent it to someone
in Australia to take into Apple for the evaluation. Apple will not accept
international shipments for repair nor will Apple ship out of the country
after replacement.
Sorry to be the bearer of this news, but it is the way iPhone warranty and
replacement has always worked. -
Previous days data based on passing parameter and date
Hi,
i have one rek..that requirement to to show the previous days data based on the number passing to the parameter parameter.
lets suppose if user enters the date '25 Mar 2012 in one dashboard prompt and in another prompt user enters the no.of days(Ex: 5).then report should display the last 5 days data i.e 25 mar 2012,24 mar 2012,23 mar 2012,22 mar 2012,21 mar 2012.
can anybody tell me how can i achieve this..
Thanks in advance...user12255470 wrote:
Hi,
i have one rek..that requirement to to show the previous days data based on the number passing to the parameter parameter.
lets suppose if user enters the date '25 Mar 2012 in one dashboard prompt and in another prompt user enters the no.of days(Ex: 5).then report should display the last 5 days data i.e 25 mar 2012,24 mar 2012,23 mar 2012,22 mar 2012,21 mar 2012.
can anybody tell me how can i achieve this..
Thanks in advance...Read the article and adapt it to what you are doing. It's very similar...
http://oraclebizint.wordpress.com/2008/03/11/oracle-bi-ee-101332-rolling-yearmonth-and-date-filters-moving-window-filters/ -
How to get previous day data if i dont have current day data.
Hello Gurus,
I have a stock levels data in ODS. when there is no movements, we are not getting any stocks into ODS. So we have to get previous day data as it is for current day data into another ODS.
Could you please help me in this regard.
Thanks in advance,
RamaRama -
0CALDAY can't help us in this scenario .
Step 1 :
To do this - You have to add one ZDATE (InfoObject ) to 1st ODS. ZDATE is updated by itself from current date of system when ever you are loading data to 1st ODS.
Step 2:
You have to do full update to 2nd ods.At the selection screen of InfoPackage (from 1st ODS to 2nd ODS ) you have to write following code for ZDATE.
pseudo Code:
1) Select fields "Rec_INSERT","Time stamp","Request Status" and "Request ID" where ICUBE = ODS1 from table "RSMONICDP"
2) Populate above selected fields data in INTERNAL TABLE
3) Sort INTERNAL TABLE by Time stamp .
4)
If (Record Count = ' 0 ' for current date in internal table )
update records from ODS1 to ODS2 where ZDATE = "yesterday date"
else
update records from ODS1 to ODS2 where ZDATE= "today date"
endif.
Make sure this is full update not delta update from ODS1 to ODS2
I am sorry, I m not good in Coding but I am sure if u use this logic,You can meet your requirement.
I hope you can understand my logic. Let me know if you have any questions,
Anesh B . -
Get previous bill date using SQL
Hi,
I am table which holds records for bill generation. I have column name gene_bill_date which is date field and it holds a value the date on which the particular bill was generated.
Now I am trying to get previous bill date, not the current bill date. I can to Max(gene_bill_date) to get current bill date, but how do I get previous bill date?
thanksHi,
Sorry, it's unclear what you're asking.
You didn't post any sample data, so I'll use the scott.emp table to illustrate. Let's say we're interested in deptno=30 only, just to reduce the output from 14 rows to 6.
If, for every row, you need to know the most recent gene_bill_date before the one on that row, you can do something like this:
SELECT ename
, hiredate
, LAG (hiredate) OVER (ORDER BY hiredate) AS prev_hiredate
FROM scott.emp
WHERE deptno = 30
;Output:
ENAME HIREDATE PREV_HIREDA
ALLEN 20-Feb-1981
WARD 22-Feb-1981 20-Feb-1981
BLAKE 01-May-1981 22-Feb-1981
TURNER 08-Sep-1981 01-May-1981
MARTIN 28-Sep-1981 08-Sep-1981
JAMES 03-Dec-1981 28-Sep-1981Are you only interested in the 2 most recent dates in the whole result set?
If so, do a Top-N Query , like this:
WITH got_r_num AS
SELECT ename
, hiredate
, RANK () OVER (ORDER BY hiredate DESC) AS r_num
FROM scott.emp
WHERE deptno = 30
SELECT *
FROM got_r_num
WHERE r_num <= 2
;Output:
ENAME HIREDATE R_NUM
JAMES 03-Dec-1981 1
MARTIN 28-Sep-1981 2
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using. -
Run the query with previous weeks date automatically
Hi Guyz,
I need to dynamically populate the previous weeks date value every week,
i.e Run the query every Monday automatically, with previous weeks date value .
Is there any SAP Exit which I can use ??
Regards,
Ravi
Edited by: Ravi Srinivas on Aug 4, 2009 1:40 PM
Edited by: Ravi Srinivas on Aug 4, 2009 1:52 PMRavi,
If you are thinking of re-running the previous week's queries automatically in the front-end, then U. Tummers is correct. You can create new columns alongside your existing query if you so wish and use your restrictions with an offset sepending on how far back you'd like to go.
Best,
Philips -
Get the COI date based on I base number and component number
Hi Experts,
I have get the COI date based on the Ibase number and component.
Please suggest me is there any FM available.
Thnx,
Sam.Hi Sam,
You mean to say u want to get the associated person to that Partner.
Which we define as Role type in CRM.
Say a person ABC is having a team lead XYZ , then you can use the table BUT050 and give the relation ship type key value
Partner ABC must be associated with Team Lead XYZ with some BP Role.
Ask it from your fucntional and use a select query to get that Team Lead name.
Hope this helps -
Date Function to get Previous week
Is there a date function to get
Let us say today is 23rd of Jun 2009
I want a date function to get previous Thursday 18 Jun 2009
and another function which get 7 days before which is Friday 12 Jun 2009.
FYI: For the current week, I was able to use:
select next_day(case to_char(sysdate,'Day') when 'Thursday' then trunc(sysdate-1) else trunc(sysdate) end, 'Thursday')
from dual;
select next_day(trunc(sysdate-7), 'Friday') from dual;
I want something similar to that.
ThanksNo, not separate functions, but you can tweak next_day to get what you want:
select trunc(sysdate) today,
next_day(trunc(sysdate)-1, 'THURSDAY')-7 last_thursday,
next_day(trunc(sysdate)-1, 'FRIDAY')-14 prev_2nd_friday
from dual;
TODAY LAST_THUR PREV_2ND_
23-JUN-09 18-JUN-09 12-JUN-09 -
Hi all,
I have a requirement where I need to show the Unbilled amount of this week as well as last 20 weeks based on region. Let say I am on fiscal week 20. Now if create a report based on region and Unbilled amount I will get $ 20 for europe. Now if after one week i.e FW 21 , I run the same report I get & 25 for Europe. Again let say after one more week i.e FW 22 I get $ 27 for Europe.
Now user if run a report on FW 22. he wants areport like
Week Region Unbilled
FW20 Europe $20
FW21 Europe $25
FW22 Europe $27
i.e history data is required . As data is changing every day , user wants to see previous 20 weeks data.
Now I am using a Zcube built on standard extarctor 0FI_GL_4. i dont have loading date or system date.
Please suggest what to do
Regards,
SunnyHi.
If your object fiscal week restricted by variable you should do the next:
1. create 20 calculated KF each one restricted with this variable with appropriate offset (lets say previous week wth vriable and offset -1, 2 weeks ago with variable and offset -2 ...)
2. create another calculated KF with variable without offset to represent user selection week.
So at the end you will see one KF with current week and 20 another KF with 20 previous weeks.
Regards. -
How to get current week data only
Dear All,
I'm running a report from January 2014 till date.
I want a variable that helps me to show only the current week data.
Please help ASAP if anyone available now.
Thanks In AdvanceHi
You should create a dynamic prompt @ universe level or @ Business layes with @Prompt.
create a filter in universe with below code
DATE BETWEEN
case
when @Prompt('Week Start Date:','A','<LOV>',,'Week Start Date')='Week Start Date' then getdate()-7
else @Prompt('Week Start Date:','A','<LOV>',,) end
AND
case
when @Prompt('Enter Date:','A','<LOV>',,'Current Date')='Current Date' then getdate()
else @Prompt('Enter Date:','A','<LOV>',,) end
PS: syntax will work for SQL server. Change syntax for other databases
Now use the filter in the report and you will get the current date data
Regards
Anil -
Hi I'm trying to put a query together that shows the dates, from monday to saturday for the current week. So for example if it's friday it has to show me monday / tuesday / wednesday / thursday and the current friday.
Does anyone know how to accomplisch this with the use of sysdate?
This is what I got now.
select trunc(trunc(sysdate,'y') + (:fw * 7),'iw') "Monday",
trunc(trunc(sysdate,'y') + (:fw * 7),'iw')+1 "Tuesday",
trunc(trunc(sysdate,'y') + (:fw * 7),'iw')+2 "Wednesday",
trunc(trunc(sysdate,'y') + (:fw * 7),'iw')+3 "Thursday",
trunc(trunc(sysdate,'y') + (:fw * 7),'iw')+4 "Friday"
from dual
but I need to get this in one column and that it wil automaticly fill in the current week date
Message was edited by:
SilvertraXSQL> select to_char(next_day(sysdate,'sunday')-7+rn,'day')
2 from
3 (select rownum rn
4 from dual
5 connect by level <= (next_day(sysdate,'sunday') - sysdate)+1)
6 /
TO_CHAR(N
monday
tuesday
wednesday
thursday
Maybe you are looking for
-
Error message for Adobe AIR 2.0.3 while trying to run Dreamweaver CS5
imac 2.66 Ghz, Intel Core i5, OS 10.6.4. Error message for Adobe AIR 2.0.3 while trying to run Dreamweaver CS5: Adobe Air the installation of this app is damaged. Try re-installing or contacting the publisher for assistance. Tried several times to un
-
Hi , I have an iPhone 5S and I have got a problem with the app store : iI can't update my apps , it is asking me to change frim the UK store to go to the french one , but i have already changed it and I am in the French one !! Help !
-
Link between 3rd party software and SAP
Our company uses a 3rd party software for its payroll processing. At the end of every 2 weeks, we receive an Excel file that the clerk sorts and uploads into SAP using LSMW. The Director of Finance thinks that this process can be achieved much quick
-
MULTICAM CLIP, retiming without affect audio
i am editing a multicam project, in time line i want to retime a clip without to affect the audio, so i lift it from storyline, press cmd r and retime, but the angle audio too is affected i want to speed up just the video and to fill gap with broll
-
'End Terminate' event does not completely terminate the process instance!
Hi, my process make use of the 'End Terminate' event, this will be used pending on the outcome of a prior task, using the 'Exclusive' gateway. This works quite well but in case of process termination some strange behavior happens. The Enterprise Mana