TIMESTAMPADD Query Filter (Last 8 weeks)

Hi Guys,
I can use some wisdom here on the best practice to pre-define a report to retrieve data for the last 8 weeks. Ideally, it will be the last business week completed going back 8 weeks. Below, is what I have put together so far which is really basic. Currently, when I run the report it pulls the current week going 8 weeks back.
The filter is being applied as a column filter under, and the field being filtered is [Week], in case this makes a difference.
TIMESTAMPADD(SQL_TSI_WEEK, -8, (CURRENT_DATE))
Another scenario, if this is possible I am looking for a way to retrieve the last 8 weeks but instead should start from two weeks back from the current week, and then 8 weeks back. Our SLA for certain records takes a full two weeks to determine if the SLA will be achieved or missed.
Example: If I ran the report today, I would expect to retrieve 8 weeks of data going back two weeks from the current week, such as today 2/21 and Current Week = 2/18/13 the weeks retrieved would be the following weeks 12/24/12 to 2/4/2013
Any suggestions greatly appreciated~!

Use the below statements for date for between operator
TIMESTAMPADD(SQL_TSI_DAY, -61, (TIMESTAMPADD(SQL_TSI_DAY, 7-dayofweek(current_date), (CURRENT_DATE))))
TIMESTAMPADD(SQL_TSI_DAY, -19, (TIMESTAMPADD(SQL_TSI_DAY, 7-dayofweek(current_date), (CURRENT_DATE))))
This is would show dates between 12/24/12 to 2/4/2013
my logical query was like
SELECT Date saw_0 FROM "SA" WHERE Date BETWEEN TIMESTAMPADD(SQL_TSI_DAY, -61, (TIMESTAMPADD(SQL_TSI_DAY, 7-dayofweek(current_date), (CURRENT_DATE)))) AND TIMESTAMPADD(SQL_TSI_DAY, -19, (TIMESTAMPADD(SQL_TSI_DAY, 7-dayofweek(current_date), (CURRENT_DATE)))) ORDER BY saw_0
Appreciate if you mark as correct
Edited by: Srini VEERAVALLI on Feb 21, 2013 2:08 PM

Similar Messages

  • Mail smart list with filter last week does not work

    I created a smart list in mail to show all emails of last week. It shows the emails of this week. In ML it used to work. any idea?

    Hi FranklyBlackk,
    If you are having an issue where neither iPhone is being recognized by iTunes, either via WiFi or USB, you may find the following article helpful:
    iOS: Device not recognized in iTunes for Windows
    http://support.apple.com/kb/ts1538
    Regards,
    - Brenden

  • Microsoft Project Server 2010 - Need a query/report to show everyone who did not submit timesheet last week

    I need to create a MSPS 2010 query/report to send out to my project managers that show them everyone who did not submit their timesheet for the previous week.  I would like to be able to filter it by project/client but would settle for just a list
    of all unsubmitted timesheets at this point.  Every link I have found point to old reports for MSPS 2007 and the queries do not work because of schema changes between MSPS 2007 and 2010.  Please help!

    Thanks Elli!  Is there any way to also pull in the active resources that have not created a timesheet in the timeframe I am filtering on as well?
    Here is the query I had came up with.  Looks like I was on the right track...  I did two actually.  First one to give me a roll up list of employees with outstanding time sheets for last week and the hours, then the same data with an explosion
    by employee by project and also pull in their associated time sheet manager:
    --Everyone with an timesheet for last week where status  is not 'Approved' or 'Submitted'
    SELECT DISTINCT
            CONVERT(varchar(10),b.StartDate,1) + ' - ' + CONVERT(varchar(10),b.EndDate,1) as [Timesheet Date]
          , [ResourceName]
          , [TimesheetStatus]     
          , SUM([ActualWorkBillable]) as [Hours Entered]
      FROM 
        [dbo].[MSP_TimesheetLine_UserView] a
      , [dbo].[MSP_TimesheetPeriod] b
      WHERE
          a.PeriodUID = b.PeriodUID 
      and [TimesheetStatus] NOT IN ('Approved', 'Submitted')
      and DATEADD(dd,-7,GETDATE()) BETWEEN b.[StartDate] AND b.[EndDate]
      GROUP BY 
        b.[StartDate]
      , b.[EndDate]
      , [ResourceName]
      , [TimesheetStatus]
    GO
    --Everyone with an timesheet for last week where status  is not 'Approved' or 'Submitted' w/ Project/Customer explosion
    SELECT
     CONVERT(varchar(10),b.StartDate,1) + ' - ' + CONVERT(varchar(10),b.EndDate,1) as [Timesheet Date]
    , r.ResourceName AS [Resource Name]
    , [TimesheetStatus]     
    , [ProjectName]     
            , ([ActualWorkBillable]) as [Hours Entered]
    , isnull(rm.ResourceName,'<No Timesheet ManagerInformation Available>') AS [Timesheet Manager]
    FROM
          dbo.MSP_EpmResource_UserView r 
     LEFT OUTER JOIN
          dbo.MSP_EpmResource_UserView as rm 
       ON r.ResourceTimesheetManagerUID = rm.ResourceUID
    ,[MSP_TimesheetLine_UserView] as a
    ,[MSP_TimesheetPeriod] as b
    WHERE
          a.PeriodUID = b.PeriodUID 
      AND a.ResourceUID = r.ResourceUID
      AND  [TimesheetStatus] NOT IN ('Approved', 'Submitted')
      AND  DATEADD(dd,-7,GETDATE()) BETWEEN b.[StartDate] AND b.[EndDate]
      AND (r.ResourceIsActive = 1)
      AND (r.ResourceType = 2)
      AND (r.ResourceIsGeneric = 0)
    ORDER BY 
       r.ResourceName
     , ProjectName
    GO

  • Filter for Created date: last week

    Im trying to put a filter on the Created date. We need to show only records from last week. Can anybody help me?
    Thanks in advance.

    WEEK_OF_YEAR(CREATED_DATE) = WEEK_OF_YEAR(VALUEOF(NQ_SESSION.CURRENT_DT))-1
    Make sure the functions and column names are correct

  • InfoView - Query Filter for date variable of previous week

    I am trying to automate the process to generate a report for the previous week's data.  Right now I just prompt the user to enter in the start & end date/times, but I would like to somehow automate the date filtering using a Query Filter.
    In particular, the report will be generated every Thursday at 12:35 PM, and it needs to filter only the date field between the date's of the previous Thursday @ 1:31 PM, and the current Thursday @ 12:30 PM.
    I know there is a way to do this using an offset or something like that, but I'm a bit of a newbie to InfoView....so any help is greatly appreciated.  Sorry if the explanation is confusing.
    Thanks so much,
    Nick

    Hi,
    You can create two objects on universe level or first database level then add in the universe based the sysdate.
    Then go to  webi  query and  replace the prompt value by these objects and from next time when ever user refresh this report will run  without any prompt.Same thing in the scheduled report.
    Thanks,
    Amit

  • Item Query by onhand/QTY Sold in last week/month/QTY

    I am trying to create a query showing items that are in a particular warehouse and then how many of that item has been sold over the last week/month/quarter.
    I have got the following query started,but i am unsure to group can anyone help with this
    SELECT T0.[ItemCode], T0.[ItemName],T1.[OnHand],   T0.[IsCommited],  T0.[MaxLevel], T0.[MinLevel], T2.[Quantity]
    FROM [dbo].[OITM]  T0 INNER JOIN OITW T1 ON T0.ItemCode = T1.ItemCode INNER JOIN INV1 T2 ON T0.ItemCode = T2.ItemCode
    WHERE T1.[WhsCode] = '01'

    I am trying to create a query showing items that are in a particular warehouse and then how many of that item has been sold over the last week/month/quarter.
    I have got the following query started,but i am unsure to group can anyone help with this
    SELECT T0.[ItemCode], T0.[ItemName],T1.[OnHand],   T0.[IsCommited],  T0.[MaxLevel], T0.[MinLevel], T2.[Quantity]
    FROM [dbo].[OITM]  T0 INNER JOIN OITW T1 ON T0.ItemCode = T1.ItemCode INNER JOIN INV1 T2 ON T0.ItemCode = T2.ItemCode
    WHERE T1.[WhsCode] = '01'

  • Check condition for last week

    Hi,
    I have a table in which records are stored according to datewise. I want to filter records for last week as per sysdate. For ex, today is thursday and i want to see records which had come in between Monday to Sunday last week.
    Please help me out here.
    Himanshu

    Hi,
    Here is the query to get first day of last week , last day of last week
    SQL>SELECT TO_CHAR((sysdate - to_char(sysdate,'D')),'DAY') LAST_DAY_OF_LW ,
           TO_CHAR((sysdate - to_char(sysdate,'D')) - 6,'DAY') FISRT_DAY_OF_LW,
      2    3         TO_CHAR(sysdate,'DAY') TOday
      4  from dual
      5  /
    LAST_DAY_ FISRT_DAY TODAY
    SATURDAY  SUNDAY    THURSDAY
    1 row selected.Note: Sunday = 1 and Saturday = 7
    Regards

  • Use Yesterday as variable for Query Filter

    Post Author: rrburton
    CA Forum: WebIntelligence Reporting
    I want to have a query filter that refers to the previous day.  In regular SQL I would use something like "= trunc(sysdate)-1".  I don't see any option for doing it this way in web intelligence, the closest it comes is selecting object and then assigning the Beginning of Last Week item from the System Date table.  What am I missing?

    Post Author: rrburton
    CA Forum: WebIntelligence Reporting
    Nevermind - I figured it out just now.  It isn't very intuitive.  In the Objects and Variables dialog in the SystemDate table there are a bunch of items like 1 day, 2 days, etc. and you select one of those and then in the code it looks like:
    WHERE   PKG_NTD_CONV.TO_ORCL_DATE(TROUBLE_TICKET_ARCHIVE.CREATE_DATE)  =  ( sysdate )-1
    It should say something like 1 day ago, 2 days ago, etc.

  • How to calculate this column (Last Week of month)?

    I have a request where it shows some calculations month wise
    ex. This report is for Dec-2010
    reporting line | Declined Rate | Approved Rate | Last-Week Declined Rate |
    Report Asia---| ------20%----- | -----45%-------- | --------4%------ |
    Report Africa-| ------44% -----| -----21%-------- | ------12%-------|
    I am trying to calculate the Last Week Declined Rate column. The logic is just not coming to my mind.
    Can anybody suggest me how should I calculate this?

    Let's see. Running this report anytime after the previous month has closed...
    1) TIMESTAMPADD(SQL_TSI_DAY, (DayOfMonth(CURRENT_DATE))*-1, CURRENT_DATE) will give you the last day of the previous month...
    2) TIMESTAMPADD(SQL_TSI_DAY,DAYOFWEEK(TIMESTAMPADD(SQL_TSI_DAY, (DayOfMonth(CURRENT_DATE))*-1, CURRENT_DATE))*-1,TIMESTAMPADD(SQL_TSI_DAY, (DayOfMonth(CURRENT_DATE))*-1, CURRENT_DATE)) will give you the Saturday prior to the last week of the month.
    3) TIMESTAMPADD(SQL_TSI_DAY,1,TIMESTAMPADD(SQL_TSI_DAY,DAYOFWEEK(TIMESTAMPADD(SQL_TSI_DAY, (DayOfMonth(CURRENT_DATE))*-1, CURRENT_DATE))*-1,TIMESTAMPADD(SQL_TSI_DAY, (DayOfMonth(CURRENT_DATE))*-1, CURRENT_DATE))) will give you the Sunday of the last week of the previous month.
    Now that you have the beginning of the last day of the previous week, you can build your filter... It will be "between 3) and 1)" above...

  • Report selecting last week of the last 12 months

    Hi,
    we're loading snapshots on a weekly basis into a cube, updating a 0calweek field from the loading date.
    The requirement for one of the reports is to have the data for the last week for each of the last 12 months, incl the current month (query filter contains calmonth restricted by variable 0CML12CM).
    For the current month, the last week available in the cube is to be selected.
    Thanks for help!
    Michel

    Add a characteristic to your cube, which shows if the week is the last week in the month. This char can be updated during data load, to either store a Y or a N.
    Then, in your query, you just get all the data where ZLASTWEEK = 'Y'
    Cheers,
    Andrew

  • Yesterday & Last week on repots

    Hi,
    1. How to calculate yesterday date from todays date?, need to view yesterday report on 2days login.
    monday i shoud view saturdays.not sundays.
    2. Mondays login i need to view last week reports, but on tuesday need to view mondays & tuesday only,
    on saturday this weeks only.
    How to set the filter on date.
    Hope the genies out there can guide me on.
    Thanks in Advance.
    Regards

    I am trying to run a report that always shows the "last full week" Sun-Sat no matter what day of the week you run it. I have tried to apply the CASE statement to my currently "rolling past week" but still get an error message when running.
    Can you please review
    CASE
    When DayofWeek(Current_Date) = 1 Then Date.Date BETWEEN TIMESTAMPADD(SQL_TSI_DAY,-8,(CURRENT_DATE)) AND TIMESTAMPADD(SQL_TSI_DAY,-1,(CURRENT_DATE))
    When DayofWeek(Current_Date) = 2 Then Date.Date BETWEEN TIMESTAMPADD(SQL_TSI_DAY,-9,(CURRENT_DATE)) AND TIMESTAMPADD(SQL_TSI_DAY,-2,(CURRENT_DATE))
    When DayofWeek(Current_Date) = 3 Then Date.Date BETWEEN TIMESTAMPADD(SQL_TSI_DAY,-10,(CURRENT_DATE)) AND TIMESTAMPADD(SQL_TSI_DAY,-3,(CURRENT_DATE))
    When DayofWeek(Current_Date) = 4 Then Date.Date BETWEEN TIMESTAMPADD(SQL_TSI_DAY,-11,(CURRENT_DATE)) AND TIMESTAMPADD(SQL_TSI_DAY,-4,(CURRENT_DATE))
    When DayofWeek(Current_Date) = 5 Then Date.Date BETWEEN TIMESTAMPADD(SQL_TSI_DAY,-12,(CURRENT_DATE)) AND TIMESTAMPADD(SQL_TSI_DAY,-5,(CURRENT_DATE))
    When DayofWeek(Current_Date) = 6 Then Date.Date BETWEEN TIMESTAMPADD(SQL_TSI_DAY,-13,(CURRENT_DATE)) AND TIMESTAMPADD(SQL_TSI_DAY,-6,(CURRENT_DATE))
    When DayofWeek(Current_Date) = 7 Then Date.Date BETWEEN TIMESTAMPADD(SQL_TSI_DAY,-14,(CURRENT_DATE)) AND TIMESTAMPADD(SQL_TSI_DAY,-7,(CURRENT_DATE))
    END
    and Advise...your prompt assistance is most appreciated.
    Thanks Debbie

  • Last Week - This Week Snapshot

    Hi,
    I'm trying to produce a sales pipeline report to show comparisons from last week to this week on certain fields within the sales stage history subject area. I have got this to work for the Total Contract Value field by using the variables VALUEOF("LAST_WEEK_BEGIN_DT") and VALUEOF("CURRENT_WEEK_BEGIN_DT"), within a column formula and filtering that column by last week, then dulicating that column and filtering by this week, i.e. FILTER("Historical Sales Stage".Revenue USING (Opportunity."Close Date" >= VALUEOF("LAST_WEEK_BEGIN_DT"))). The issue I'm having is if I then want to do this for other non - metirc columns (i.e. Probability %), it doesnt allow me because you cant filter on non metric columns within a formula. So how else can I go about this please??
    Regards

    Hi,
    Unfortunately version 1.3 does not support custom ringtones.
    However, there is a workaround:
    you can search and install this app on your device through the Marketplace:
    https://marketplace.firefox.com/app/ringtone-picker

  • Uni on Bex-Query: filter on Structure - Without Keyfigures as column: error

    Hi All,
    I have a 'Without Key Figure structure' as a column called Version in which (amoung others) the values 'Actual' and 'Last Year' .
    Thus
    Version
    - Actual
    - Last Year
    Now i want to create a filter in my universe which pre-selects Actual.
    When I use the tool for that this is my standard definition of the filter:
    <FILTER KEY="@Select(Version\Version)">
      <CONDITION OPERATORCONDITION="Equal">
        <CONSTANT VALUE="Actual"/>
      </CONDITION>
    </FILTER>
    However it results in error: 'A database error occured. The database error text is: (CS) "Error on BindCol". (WIS 10901)'
    Meaning(i guess) that somehow i'm not getting the correct selection-command to the database,
    When i use the version-dimension itself in the reports as part of the query filter it works fine and LOV displays both versions for selection.
    We are using XI3.1 fp3.1; BW 701-sp5 on oracle 11
    I've look through the forum, but couldnt find an answer.
    If there is point me into that direction and i'll close this one
    Any other information on how filters etc should be specified in an Universe on a BW query is also greatly appreciated.
    I already have found some info but any information is welcome.
    Your help is greatly appreciated.

    I found my answer.
    Create a caption dimension for your keyfigures and filter on thath
    Dimension:
    [xxkeycharacteristicxx].[caption]
    Filter:
    <FILTER KEY="@Select(Key Figures\Key Figures Caption For predefined filters)"><CONDITION OPERATORCONDITION="Equal"><CONSTANT CAPTION="VERSIONS like Actual"></CONSTANT></CONDITION></FILTER>

  • Logged users for last week or last  7 days

    Hi in my application there is log for who is logging and i want to find who logged for last 7 days or last week.i tried the following query and its not workinghow to fix it
    select uid,agentid ,logtime from agnt_mst
    to_date(to_char(logtime,'dd-mm'),'dd-mm') between to_date(to_char(sysdate,'dd-mm'),'dd-mm') and to_date(to_char(sysdate,'dd-mm'),'dd-mm') - 7;

    Here trying for one test table
    desc emp_benefit
    employee_number varchar2(30)
    employee_name varchr2(40)
    dob date
    select distinct employee_number,dob from emp_benefits
    WHERE trunc(dob) >= trunc(sysdate-5)
    it shoud return
    70935     Mrs. Mervatte      17-AUG
    74552     Mrs. Dona      18-AUG
    75331     Mrs. Ramesh     20-AUG
    76068     Mr. Fernandes     17-AUG
    72366     Ms. Rajaa      19-AUG
    rgds
    raj

  • Inquiry quantity comparison with last week same day

    hi,
    i have a report to generate in BW, which needs to compare today's inquiry quantity with last week's same day quantity.
    for example. week2 monday comparison with week1 monday comparison.
    how to achieve in BEx to generate this report?
    regards
    venuscm

    Hi,
    Create two variables on 0CALDAY.
    1. For Current date
    2. For the correspodning date of the last week.( Same day as of current week)
    For the second variable , deduct 7 from the system date. it will give you the date of the same day in the last week.
    For e.g. system date is 10.05.2010 . and its a Monday.
    If you deduct 7 from the date it will give the date of the monday in the last week.
    Now create tow selection in the query structure one with current date variable and another one with the corresponding date of the last week.
    N compare them.
    Hope this will help.
    -Jaimin

Maybe you are looking for