Use a filter to get previous months results

Hello,
I want to put a filter on a new report that will only pull information from the last month. I know I can use a timestamp calculation to get 30 days back...but this will pull info 30 days back from when the report is run.
I want one that will pull Octobers info if run anytime in November, for example.
The filter will be on the "created date" field.
Thanks!

Hi,
I am facing a similar issue.
In the report, I have 3 columns to display data for -> Current Month, Current Month - 1 & Current Month - 2.
The formula that I am using is something like this:
CASE WHEN (Condition A AND Condition B) THEN (Expression X) ELSE (Expression Y) END
Here the Condition B is:
MONTH(Activity."Planned Start Time") = (MONTH(CURRENT_DATE)) for the Current Month
MONTH(Activity."Planned Start Time") = (MONTH(CURRENT_DATE)-1) for the Previous Month &
MONTH(Activity."Planned Start Time") = (MONTH(CURRENT_DATE)-2) for Previous to Previous Month
This works ok for months from March to Dec, however for Jan and Feb, the data for Nov & Dec is not visible.
How can I remedy this? Is there any variable to represent LAST_MONTH?
(I tried to used embedded CASE statement to check the condition that if (for Current Month - 1), Month = 1, then Start Time = 12 & Year = Year(current_date) -1 , but that did not work.)
Ady

Similar Messages

  • How to Get Previous Month Salary for a particular employee?

    Hi
    I am developing a report to get the Net Pay Difference from Previous month.
    I am using logical database pnp.
    My question is how can we get the last month (Previous from current selected month) salary of perticular employee. I read the thread which is related to this but I can't understand the reply's. I think it is due to that I am new in ABAP and my experience in only 22 days. If someone reply with code example then it will more helpful for me.
    Also If you can tell me the table name from where we can get the salary of particular month of particular employee then it will also helpful for me.
    Regards
    Iftikhar

    Hi,
    Payroll data is stored in cluster tables.
    You can either use macro for retrieving the data or Function module.
    1. Use FM -CU_READ_RGDIR for getting the RG directory values.Pass  
      employee Number and molga.You will get all the sequence Numbers from this
      FM.
        The last record will be the latest  one.
    2.  Then Use FM - PYXX_READ_PAYROLL_RESULT for getting the payroll  
         results table.Pass cluster ID- 'IN'  ,pernr ,sequence number for which period
          you want (In your case ,current period minus   1) and
          READ_ONLY_INTERNATIONAL            = 'X',
    3. You will get all the results from PAYROLL_RESULT                     = it_result
      Then you can loop this internal table like LOOP at it_result-inter-rt into wa..
    Get the net pay value(/560 wage type)
    Reward points if helpful.
    Regards,
    Manoj.

  • Getting previous month

    could you please tell me how to get previous month?
    using sysdate gives me current date. from that i can get current month using to_char function. But how can I get the previous month?

    All you ned to remember is that there are two date units, days and months. Everything else is a multiple/fraction of these.
    To increment
    n days:    SYSDATE + n
    n hours:   SYSDATE + n/24
    n minutes: SYSDATE + n/24/60
    n seconds: SYSDATE + n/24/60/60
    n weeks:   SYSDATE + n*7
    n months:  ADD_MONTHS(SYSDATE,n)
    n years:   ADD_MONTHS(SYSDATE,12*n)

  • To get previous month's data

    Hi
    My report requirement:
    Display current month and previous month's data (sal) next to each other based on the month selected as a current month.
    Expression I'm using at the moment:
    case when trunc(lag(dt,1,dt) over (partition by ename order by dt),'MM') = trunc(add_months(dt,-1),'MM')
    then lag(sal,1,sal) over (partition by ename order by dt)
    However, instead of 'dt' I'm trying to use a parameter (dt as a current month's dt).
    This gives me an error message.
    Can anyone guide me on this?
    Thanks and regards,
    Aparna

    Why not simply join the table with itself? I.e. join the two months data sets and have a single row containing current and previous month results
    Simplistic example. We have a YEARLY_TOTALS table where the primary key is MONTH in the date format YYYY/MM. You can then compare the sales totals per month of this year with that of last year using the following type of SELECT construct:
    SELECT
    cur.month,
    cur.sales as CURRENT_SALES,
    prev.sales as LAST_YEAR_SALES
    FROM yearly_totals cur
    JOIN yearly_totals prev
    ON ADD_MONTHS(prev.month,12) = cur.month
    WHERE cur.month >= TRUNC(SYSDATE,'YY')

  • Which SQL function to use to get previous month's data?

    Hi
    The reporting need: Display of two month's payroll run results....current and previous (based on the parameter passed) in Oracle Discoverer.
    Data source: A table in which run result values are stored. Of course to be linked to number of other tables.
    Can somebody guide me on which SQL function to use to get the data for previous month?
    Secondly, as Discoverer does not support parameters, I cannot put parameter in the query itself. I'll be applying parameter later while generating my report.
    Please advice.
    Thanks and regards,
    Aparna

    It's not very clear in my head... but you can try :
    SQL> select * from test;
    ENAM        SAL DT
    TOTO       1000 30/05/06
    TOTO       1001 20/04/06
    TOTO       1002 11/03/06
    TATA       2000 30/05/06
    TATA       1500 20/04/06
    TUTU       3500 30/05/06
    6 rows selected.
    SQL> select ename, dt, sal currmonth,
                case when trunc(lag(dt,1,dt) over (partition by ename order by dt),'MM') = trunc(add_months(dt,-1),'MM')
                     then lag(sal,1,sal) over (partition by ename order by dt)
                     else null end prevmonth
         from   test
    SQL> /
    ENAM DT        CURRMONTH  PREVMONTH
    TATA 20/04/06       1500
    TATA 30/05/06       2000       1500
    TOTO 11/03/06       1002
    TOTO 20/04/06       1001       1002
    TOTO 30/05/06       1000       1001
    TUTU 30/05/06       3500
    6 rows selected.
    SQL>
    SQL> Nicolas.
    Just an additional question : do the previous month is current month-1, or is there hole in month suite (e.g. the previous month can be current month-2) ?
    Message was edited by:
    N. Gasparotto

  • How to get previous month data from current month values

    Hi Experts,
    I have made one universe from BW Query in which Fiscal year period is entered in interval.
    I have made a universe from that and want to develop webI reports on top of that.
    In my webI reports, i have used one cross tab. In Rows section i have added Company Code and in Column section i have used Fiscal Year/Period and in Value section i have added Sales Value. I want this value of previous month.
    Requirement:
    Ex.
                            Feb'09          Mar'09     and so on...
    Comp_code1   Sales of Jan'09         Sales of Feb'0f         and so on....
    I am getting this.
    Ex.
                            Feb'09          Mar'09     and so on...
    Comp_code1   Sales of Feb'09         Sales of Mar'09         and so on....
    I hope i have clear my requirements.
    Please help as soon as possible.
    Thanks in Advance,
    Rishit

    Hi Rishit,
    Follow the below steps to get the desired result.
    Step1: Convert your fiscal year period from char to a date in your database or in your designer however its feasible.
    to_date('substr('009.2009',2)','mm.yyyy')
    you will get the result 01 sep 2009
    Step2: Convert this format to 01/09/2009 by using date functions.
    Step3: Create a Detail associated to the 'date' field (typically your fiscal period).
    Step4: Create a cross tab Like : Rows section should have Company Code and in Column section should have 'date'(created detail) and in Value section should be Sales Value.
    you should get the following result.
    01/02/2009 01/03/2009 and so on...
    Comp_code1 Sales of Feb'09 Sales of Mar'09 and so on....
    Step5: Use the following formula in your Column (date) formula bar.
    =(<date>-1)-DayNumberOfMonth(<date>-1)+1
    You will get the following result:
    01/01/2009 01/02/2009 and so on...
    Comp_code1 Sales of Feb'09 Sales of Mar'09 and so on....
    Format the cell according to your reruirement.
    Let me know if you will get any break in the above steps.
    Regards,
    Swati.

  • Struggling with MDX Filter Expression for Previous Month in SSRS

    I am trying to query only data from the previous month. 
    I looked at my Month member and the it looks like so... [Date].[Calendar].[Month].&[2015-04-01T00:00:00]
    Here is my filter expression:
    StrToMember ("[Date].[Calendar].[Month].&[" + format(now(),"yyyy-MM") +  "-01T00:00:00]" ).lag(1)
    I am not getting any errors, I am just getting getting "No rows found" - however there is certainly data in last month. I even tried removing the lag() function thinking that might be causing it, but there are still no errors, just no rows returned.
    Here is the complete query:
     SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, NON EMPTY { ([Date].[Calendar].[Date].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT ( StrToMember ("[Date].[Calendar].[Month].&[" +
    format(now(),"yyyy-MM") +  "-01T00:00:00]" ) ) ON COLUMNS FROM [Data Warehouse]) 

    Hi S,
    I can't tell exactly what your issue is, but I can give you a couple of tips to help diagnose it.
    Try the following queries. They aren't fixes, just simplifications of your query to help you diagnose where the issue is.
    --This query will let you what your string function is returning with what you want.
    With member measures.x as "[Date].[Calendar].[Month].&["
    + format(now(),"yyyy-MM") +  "-01T00:00:00]" 
    member measures.y as [Date].[Calendar].currentmember.uniquename
    select {measures.x,measures.y} on 0
    [Date].[Calendar].[Month].&[2015-04-01T00:00:00] on 1
     from [data warehouse]
    --This query will give you the date without lag
    SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, StrToMember ("[Date].[Calendar].[Month].&["
    + format(now(),"yyyy-MM") +  "-01T00:00:00]" )  on rows FROM [Data Warehouse]) 
    --This query will give you the date with lag
    SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, [Date].[Calendar].[Month].&[2015-04-23T00:00:00].lag(1)  on rows FROM [Data Warehouse]) 
    --This query will give you the date with lag
    SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, StrToMember ("[Date].[Calendar].[Month].&[" + format(now(),"yyyy-MM") +  "-01T00:00:00]" ).lag(1)  on rows FROM [Data Warehouse]) 
    --This query will show you the member without lag
    SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, NON EMPTY
    { ([Date].[Calendar].[Date].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT ( StrToMember ("[Date].[Calendar].[Month].&[2015-04-01T00:00:00]" ) ) ON COLUMNS FROM [Data Warehouse]) 
    --This query will show you the member without lag
    SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, NON EMPTY
    { ([Date].[Calendar].[Date].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT ( StrToMember ("[Date].[Calendar].[Month].&[2015-04-01T00:00:00]" ) ) ON COLUMNS FROM [Data Warehouse]) 
    --This query will give you the date without lag
    SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, StrToMember
    ("[Date].[Calendar].[Month].&[" + format(now(),"yyyy-MM") +  "-01T00:00:00]" )  on rows FROM [Data Warehouse]) 
    --This query will give you the date without lag
    SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, StrToMember
    ("[Date].[Calendar].[Month].&[" + format(now(),"yyyy-MM") +  "-01T00:00:00]" )  on rows FROM [Data Warehouse]) 
    --This query will give you the date without lag
    SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, StrToMember
    ("[Date].[Calendar].[Month].&[" + format(now(),"yyyy-MM") +  "-01T00:00:00]" )  on rows FROM [Data Warehouse]) 
    Richard

  • How to get previous month's values for current month

    Hi..
    I have a requirement on a report, where for a particular month, the key figure value should be from the previous month.
    Eg: KF1 value for Sept 2007 should come from Aug 2007, KF value for Dec 2007 should be the value of Nov 2007, etc.
    There are other key figures on the report which do not need this logic. It is only for one key figure.
    Should we do this on the backend or front-end, and how? Any tips will be appreciated.
    Thanks
    R.

    hi,
    Use a Restricted Keyfigure.
    Drag your KF1 and Drag Calandar Month with a Variable Current Cal Month with variable Offset to -1.
    KEERTTHi

  • Problem in measure for previous month

    i have columns like following
    d_name Value
    JAN-11 4586236
    FEB-11 2121512
    MAR-11 32121
    APR-11 12121
    p_name is varchar2 type
    Now i need value for previous month can u do it without using queries or obiee
    I am unable to build hierarchy cause of its type. any suggesions

    You might have month numbers in rpd, use ago function to get previous month value

  • Using previous rendering result

    Hello all,
    I write an effect plugin which work interactively with layer/composition viewer. Effect uses its own brush (see Paint or Distort->Liquify effects for example) and user can draw something on video with this effect.
    Example:
    So i rerender current frame with each user action (with each new brush stroke added). I save all strokes and can render resulting frame from "source" layer frame, but this way is a bit slow. More efficient solution is to use result of previous rendering and apply new brush stroke to it.
    Is there a way to get previous rendering result for current frame in AE? (it should be saved in cache at least).
    Thanks!

    Thx for reply, shachar!
    shachar carmi wrote:
    i'll begin with the bad news.
    you can't ask AE for the last output of your plug-in.
    maybe it's cached, maybe it's not, but either way you can't access it.
    Thx, my doubts are gone)
    shachar carmi wrote:
     you can cache it yourself in the sequence_data memory block.checkout the following thread:
    http://forums.adobe.com/message/2732025#273202
    it's very similar to what you'd want to do if you choose to cache your output.
    Yes, i agree. I thought about it too. But when I attempted to realize this solution first I faced with the problem of input frame resolution chaos (when AE can't calculate result realtime, it try to get result with lower resolution). Indeed, your proposal partially solves the problem.
    Thanks again.

  • OLAP Universes - Based on BEx Query - Month and Previous Month Functions

    Hi,
      I created a Universe based on SAP BEx queries and I like to create a filter so that I use in Web Intelligence report to run for "Previous Month" data always. There are "Date" filelds in BEx Query(No Month info only date data). I have no knowledge of SAP BEx Queries and new to OLAP universes. Could you help.
    How to create filter that show Previous Month.
    Nanda Kishore
    Edited by: Nanda Kishore B on Dec 26, 2010 6:15 AM

    The easiest way  (but NOT the most efficient one) is to create a local variable (Dimension) in your report with the following code:
    =if (Month(CurrentDate())=1 AND Month([[MyDate]])=12 AND Year([[MyDate]])=(Year(CurrentDate())-1)) OR (Month(CurrentDate())>1 AND   Month([[MyDate]])=(Month(CurrentDate())-1)) then 1 else 0
    where MyDate is the field from your query containing the data information
    Activate the report filter area in your report design panel by pressing the Report filter icon and drag and drop your variable there and apply it to the entire report. Filter value 1 and you will get the data for the previous month.
    Keep in mind that this approach is not optimal especially if you do have many rows of data delivered to your WebI report because filtering takes place only AFTER the data is retrieved. The Best practice here is to work with BEx variables.
    How many rows of data does your WebI report normally fetches?
    Regards,
    Stratos

  • Parameter for Current Month and Previous Month

    I'm trying to create a parameter for current month and previous month based on the ex_date, but not sure what i'm doing wrong. 
    where ex_date = @SelectDate
    I created a second dataset below for the values in the parameters.
    SELECT Month(CURRENT_TIMESTAMP) AS 'Month', 'Current Month' as 'Current Month'
    union all
    SELECT Month(CURRENT_TIMESTAMP)-1 AS Month, 'Previous Month' as 'Previous Month'
    Results
    Month Current Month
    3 Current Month
    2 Previous Month
    Once I preview it I get "Conversion failed when converting date and/ or time from character string" I changed the data type to "date/Time" but that did not make a difference. The date is convert (varchar(10), ex_date, 101) so looks like
    11/12/2014. 
    I've also tried expressions like =month(now()) to pull current month with same error so i'm not sure what i'm doing wrong. Any ideas?

    i tired this real simple report
     in the first dataset - my main report query - select name from sysdatabases where month(crdate())=@month
    in the second dataset - select month(getdate()) as Month1
    in the parameters - choose int data type and available values - select the second data set
    in the first data set- add this parameter..( i am assumming you know this, since you have done)
    in the preview you should get the drop down with current month number - 3
    and if you run the report, it will display the database names that were created in march. remember we are no checking year, so will get all that were created in march across the years.
    Hope it Helps!!
    I'm looking to have the dropdown say "Previous Month" and "Current Month" as a option. I know how to get the information in SQL, but not sure how this translates or put into a parameter.
    Current Month
    list_date BETWEEN
    DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()), 0)
    AND
    DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()) + 1, 0)
    Previous Month
    list_date between
    CONVERT(varchar,dateadd(d,-(day(dateadd(m,-1,getdate()-2))),dateadd(m,-1,getdate()-1)),106) /* Last Month */
    and
    CONVERT(varchar,dateadd(d,-(day(getdate())),getdate()),106)

  • To retrive previous month based on month prompt

    Hi,
    My universe is based on SAP BEX query. I have a requirement to report the previous month data based on a month prompt. Since the universe is based on the MDX, could anyone suggest a way to calculate previous month from universe.
    Appreciate your responses.
    Regards,
    VyshBO

    pvinesh wrote:
    Hi VyshBO,
    >
    > You can refer below syntax and prepare a filter object in universe to get Previous Month.
    >
    >
    <FILTER KEY="[ZMONTH].[LEVEL01].[[ZMONTH]].[Value]"><CONDITION OPERATORCONDITION="Equal"><CONSTANT CAPTION="-1"/></CONDITION></FILTER>
    >
    >
    > Regards,
    > Vinesh
    Can  you explain that syntax, Vinesh? In particular, what does the [[ZMONTH]] imply?

  • Previous month first data and previous month last date

    can any body have query to get previous month first date and previous month last date.
    Ex: First day of the previous week:
    TIMESTAMPADD(SQL_TSI_DAY,-6, (TIMESTAMPADD(SQL_TSI_DAY, DAYOFWEEK(CURRENT_DATE) *-1,CURRENT_DATE)))
    Last day of the previous week:
    TIMESTAMPADD(SQL_TSI_DAY, DAYOFWEEK(CURRENT_DATE) *-1,CURRENT_DATE)
    can anybody have it for first day of the previous month,last day of the previous month?
    Edited by: user12255470 on Apr 7, 2010 3:30 AM

    Hi,
    1st day of previous month :
    TIMESTAMPADD(SQL_TSI_DAY, ( DAYOFMONTH(TIMESTAMPADD(SQL_TSI_MONTH,-1,CURRENT_DATE)) * -1) + 1, TIMESTAMPADD(SQL_TSI_MONTH,-1,CURRENT_DATE))
    last day of previous month :
    TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(TIMESTAMPADD(SQL_TSI_MONTH,-1,CURRENT_DATE)) * -1 , TIMESTAMPADD(SQL_TSI_MONTH, 1, TIMESTAMPADD(SQL_TSI_MONTH,-1,CURRENT_DATE)))
    Please mark Q answered and award points for correct answers !
    Thanks
    Alastair

  • How to get last month with af:convertDateTime?

    Hi All:
    I know use af:convertDateTime can get the month value from the inputText which stored the datatime value. But if use this can get the datetime value's last month?
    Thanks.
    regards.
    Alex

    Hi,
    not sure what the usecase is about. Can you provide more information?
    "Converts string into java.util.Date and vice versa based on the pattern and style set."
    http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/convertDateTime.html
    Its a converting between data types and doesn't change the value. However, I am wondering if what you want to accomplish can be done in Java using a ValueChangeListener
    Frank

Maybe you are looking for

  • Simple but reliable small office setup

    Hi group, I need some advice on setting up a simple but reliable small office wireless network. Up until now, we had a consumer AP combined with wired connections. However, we're moving to a new office where it's difficult to implement a wired networ

  • Safari unstable since upgrading to Lion OS

    Since upgrading to Lion OS I have been unable to access my remote office though Safari due to Safari quitting / crashing when using the site. This did not happen when using Snow Leopard. I have inserted the diagnostics text I receive when Safari quit

  • Infotype for OFLA Event

    Hello Gurus, I have the event type as FMLA .I have got the infotype for this event as P0672. Can you please tell me the infotype for this event type OFLA .Please its urgent. Thanks,

  • Keyword list length in 2.1

    Hi all... not sure if Ive done something wrong here, but have imported catalog from 1.3 to 2.1 and a weird thing happened to the keyword list. I can only go down about halfway with my scrolling.... get to the letter 'I' and no further. If I delete a

  • Screen sharing in listen mode only

    Hello readers I try to use either VNC or "Screen sharing" to connect to a remote mac Mini. Both works. If I use a VNC clienet, I can set "Observing Mode", which does prevent all mouse and keybord action to be sent to the remote host. Unfortunately I