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)

Similar Messages

  • Parameter for current year and previous year

    Hi all,
    I currently have 2 reports where the query is the same except in the where clause I have it filtered to current year and previous year based on the List_Date. I would like to make this one report with a parameter of Current or Previous year.
    Would I create 2 more datasets one for current and another for previous? I would think there is a easier way. Any help or direction would be great.  

    If you define a parameter in SSRS, you can use it's value in your query. Just make sure the parameter name, and CASE (SSRS is case sensitive when it comes to parameters) are the same in SSRS and your query. There's a parameter tab on the dataset properties.
    It SHOULD auto fill, but it never hurts to check, just in case.
    Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question.
    Yes it did auto fill the parameter tab in the dataset and I get a parameter to enter the year when I preview the report. Still a little confused on how I do current or previous year. Are the next steps what I need to do?
    @yearParam parameter:
    1) Create  Available or Default values 
    2) Current and Previous year as label
    3) For Value do I need to use a expression for current year =Year(now()) and previous Year?
    4) Add a filter on the tablix for list_date?

  • 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.

  • Balance sheet required for current quarter and previous quarter

    Hi Guys,
                 I am using 0FIGL_C10 cube for balance sheet report,i need to create balances for current quarter and previous quarter.
    user will enter the fisper, based on fisper it has to show the current quarter and previous quarter balance.
    how to calculate the quarter using fisper.

    you can use offset with ranges.
    or
    just offset of -1 , -2 & -3 seperately in 3 selections and add it in one column in formula (this will give u current quarter).
    similarly offset of -4, -5 , -6 will give u previous quarter result.
    total of 6 selection and 2 formulas. hide all selections from display.

  • Current year and previous year

    Hi All Grus,
    i have a one requirement user will give input 30.04.2009 . the output should show last ten days including user entered date like 21.04.2009 to 30.04.2009 for current year and previous year
    this current year and previous should show column wise in row wise i need year like  given below
    user input:  30.04.2009
    row            column                                                                               
    21.04.09  22..04.09. 23..04.09 ..............................................................  30.04.2009
    2009       100          200            300         ...............................................................     500                            
    2008        200          300          600          .................................................................    1000               
    Edited by: kek.uthayakumar on Aug 4, 2009 7:57 AM
    Edited by: kek.uthayakumar on Aug 4, 2009 7:58 AM

    Hi
    You need to have customer exit variable on this calday and write code to obtain your logic. Search in SDN for sample codes:
    enter information required in search forum SAP Business Explorer (SAP BEx)
    Regards
    Ravi

  • Sales report for current month and year a go month

    i could you please guide me builting report for current monthwise for current month and year a ago month
    report parameter month_year='06-2010'
    tables = sales and below are the table fields
    customer_id
    invoice_dt
    invoice_am
    thanks
    nhm

    Okay, Still you did not mention how you will pass value in report while generating.
    Anyway the query with UNION ALL will work. For Example.
    I am assuming that the parameter for date/month you will pass in range like 01-JUN-2010 to 30-JUN-2010
    SELECT customer_id, SUM(curr_value) curr_value, SUM(past_value) past_value
    FROM
    SELECT customer_id, NVL(SUM(invoice_amount),0) curr_value, 0 past_value
    FROM sales
    WHERE invoice_dt BETWEEN :P_FROM_DATE AND :P_TO_DATE  -- here P_FROM_DATE and P_TO_DATE will be the date range for current year as i showed above.
    AND  -- Any Condition goes here...
    GROUP BY customer_id
    UNION ALL
    SELECT customer_id, 0, NVL(SUM(invoice_amount),0)
    FROM sales
    WHERE invoice_dt BETWEEN ADD_MONTHS(:P_FROM_DATE,-12) AND ADD_MONTHS(:P_TO_DATE,-12) -- This add_months function for the previous year same month.
    AND -- Any condition goes here...
    GROUP BY customer_id
    GROUP BY customer_idNow using the above query you can design the tabular report as you showed the format.
    -Ammad
    Edited by: Ammad Ahmed on Jul 3, 2010 7:55 PM
    added GROUP BY

  • Showing Calendar for Current Month

    Dear Forum,
    I intend to display calendar in corner region of my home page for current month, and also want to highlight dates in calendar based on certain parameter or query output.
    How should i accomplish this in HTMLDB?
    Regards,
    Manpreet Johal

    Sir,
    Please answer to this problem asap.
    Regards,
    Manpreet Johal

  • Can i add data for current month only

    can I add data for current month only?

        Knowing your plan options is important marlingut! So that we are able to provide correct information, what make and model phone are you trying to add data too? Is this device already activated on your account?
    Thank You,
    MichelleL_VZW
    VZW Support
    Follow us on Twitter @VZWSUPPORT

  • Report for getting an oppotunity for current month

    Please tell what can be a filter or function for getting an oppotunity for current month , i have the field as "Opportunity created date" so what function or SQL expression can b eused to get created date = current month's date

    Thanks..i'll do taht
    Edited by: user1074008 on Sep 28, 2010 3:11 AM

  • SapExit for Current month

    Hi,
    We have a scenario where we run the query monthly, expectation is the query should automatically default to using the current month. So do we have any sap exit for current month.
    Regards,
    Ravi

    Hello Please refer the following code
    MTD / MTM(For current default Month)
    Variable: ZP_X_09 For enetered month (on 0CALMONTH)
    For current Month by default or for any given Month (For full month)
    e.g. If current month/given month is 15.08.2009. It will give Aug-09.(200908)
      WHEN 'ZP_X_09'.
        IF i_step = 1.
          w_fm_month = sy-datum.
          CLEAR l_s_range.
          l_s_range-low    = w_fm_month.
          l_s_range-sign   = 'I'.
          l_s_range-opt    = 'EQ'.
          APPEND l_s_range TO e_t_range.
          CLEAR : w_fm_month.
        ENDIF.
        IF i_step = 2.
          LOOP AT i_t_var_range INTO loc_var_range
            WHERE vnam = 'ZP_X_09'.
            CLEAR l_s_range.
            l_s_range-low    = loc_var_range-low.
            l_s_range-sign   = 'I'.
            l_s_range-opt    = 'EQ'.
            APPEND l_s_range TO e_t_range.
            EXIT.
          ENDLOOP.
          CLEAR : w_fm_month.
        ENDIF.
    Regards,
    Krunalkumar Rathod

  • COPA Report current period and previous period issue

    Hi Gurus,
    I have defined COPA report (Tcode KE94) based on line items. Now I want all values to be displayed based on an entry parameter in terms of period. That is to say that  If I give input values of "010.2013" as a period entry , my report should display the values for the the period specified i.e. 010.2013 in the first column and in second column  values for the period 009.2013 should be displayed and in the third column values for the period 001.2013 till 010.2013 should be displayed cumulatively.
    For this, I choosed the character "period/year" in General data selection tab, clicked "Variable on/off" tab and gave values "From"  as well as "To" for the Global Variable "OFP"  which is Curr.fisc.per./year.
    For the 1st column (1st column which is suppose to display the values according to selection parameter), along with the character "company code" , I choosed the character "period" and clicked "Variable on/off" tab and gave value "From"  as well as "To" for the Global Variable "OFP"  which is Curr.fisc.per./year.
    For the 2nd column (2nd column which is suppose to display the values for the immediately preceeding period of the selection parameter), along with the character "company code" , I choosed the character "period" and clicked "Variable on/off" tab and gave value "From"  as well as "To" for the Global Variable "OFP"  which is Curr.fisc.per./year. While doing so, I selected operator as "-" and choosed offset as 1.
    For the 3rd column (3rd column which is suppose to display the cumulative values from the beginning of the fiscal year till the period mentioned in the selection parameter), along with the character "company code" , I choosed the character "period" and selected 001 in "From" and 016 in "To" tab.
    Company Code selected in all the three columns is same and I have selected actual values i.e. 0 for "plan/actual indicator" tab.
    When I run the report through Tcode KE30 , I give values as "010.2013" for the From and To selection tabs. System shows the values as per the selection parameter in the 1st column which is correct  but display values same as per coulmn 1st in the 3rd column which is wrong because it should be cumulative. 2nd column is blank. 
    How to display the values for the immediately preceeding period and for cumulative period?
    Regards,
    makrand

    Dear Ajay,
    Thanks for the reply. Here are the screen shots.
    For the general data selection tab
    For the first column "current month" i.e. for the month
    For the second column "Last Months"
    For the third column "Cumulative" i.e. year to date
    Following is the result of KE30
    Values for the period 010.2013
    You can see that values in the report for the period 011.2013 contains value for the previous period which is 59090.21
    This value is matching when the report is run for the period 010.2013.
    But in both the reports,the figures for Current month and YTD (year to date) are same.
    Please let me know what setting is required in the current month column.
    Regards,
    makrand

  • Display Current Quarter and Previous Quarter???

    Hi Gurus,
    I Had a requirement to display only the current Quarter and previous quarter in the report level using single quarter column.
    and my quarter value type is Q1 2013.
    Please anyone help me out on this asap/
    Thanks.

    Hi,
    Using time serious function you can acheive this requirement.
    http://obieetutorialguide.blogspot.in/2012/02/modeling-time-series-function-in-obiee.html
    OBIEE 11g Time Series Function
    or,
    Using presentation variable you can achieve this.
    Re: OBIEE 10g LY YTD returns YTD for past years
    The above thread for year you can change to qtr.
    Hope this help's
    Thanks,
    Satya

  • Displaying current year and previous year's data.

    hi all,
    we have fields like doc.no, company code, costcenter, posting date, year etc... in a query.
    we are using this query to display data in VC,
    how can i display the current year and previous year's data in two different tables using the available fields.
    any help will be highly appreciated.
    thanks,
    Rk

    Hi Rk,
    You can achieve your requirement using 'Filter' operator. Drag one 'Filter' operator into visual composer story board and drag the output into filter and add condition(Check year=2008) and drag one table from filter. For another table use another filter and change the condition.
    Hope it helps...
    Regards
    Basheer

  • BEx - Display current year and previous year by day on the same row

    Hello experts, need some help/suggestions on how I can accomplish the following please. 
    We have a requirement to show MTD revenue by day for the current year and previous year.  The desired result will have the following columns
    Calendar Day   |     Current MTD Revenue     |     Prev MTD Revenue
    11/01/2009       |      15,131,005                    |        15,138,668
    11/02/2009         |    15,055,345    |                        15,523,762
    However, the result is showing up as follows:
    Calendar Day   |     Current MTD Revenue     |     Prev MTD Revenue
    11/01/2008       | |                                                   15,138,668
    11/02/2008       | |                                                   15,523,762
    11/01/2009       |      15,131,005 |
    11/02/2009       |      15,055,345 |
    The number of rows for Calendar Day varies depending on the date the user selects.  We only want to display the days for the current year with the Previous Year Column on the same row. 
    Can someone please let me know how I can get the results to display on one line for each day? 
    Thanks,
    David

    I have the same issue on my end, and am interested in responses. I searched the forum and found this suggestion in another post; not sure if this solution will help, but it looks like it might. This was a response from poster RadhaN:
    RadhaN  
    Posts: 390
    Registered: 8/27/09
    Forum Points: 876 
       Re: a simple query to show sales versus last year on daily basis/   
    Posted: Sep 21, 2009 9:53 AM    in response to: Shlomi Weiss           Reply 
    HI Shlomi
    Create a virtual characteristic in your infoprovider that can calculate the day from calendar Day. In ZXRSRZZZ while adding code for this virtual characteristic use the function module DATE_COMPUTE_DAY to compute the day for every calendar day.
    For calculating Sales Current year, create a restricted ky figure with Sales as the key figure. Add 0CalDay to this RKF and create a variable for this infoobject(Eg: ZCURYEAR) that will receive input from the user for the range of dates eg: 08/16/2009 - 08/22/2009.
    For Sales Prior year, create another restricted key figure with Sales. Add 0CalDay to this RKF and add a customer exit variable. In the Customer exit code use the ZCURYEAR variable and offset it to prior year in both the upper and lower limits. This should work.
    I hope this helps.
    Thanks.

  • How to fetch year till date value for earning for current ,last and year

    hi,
    how to fetch year till date value for earning for current ,last and year before that from payroll result
    plz reply soon,
    pratyush

    Dear Pratyush,
    Pick this from CRT.
    Use LDB PNPCE & Fire event GET PAYROLL &
    then you can pick from CRT.
    Hope this helps.
    Kindly reward in case useful.
    Regards & Thanks,
    Darshan Mulmule

Maybe you are looking for

  • How to Change Journal Header name to Custom Header Name while GL Importing?

    Hello Experts, I am in situation where customer wanted to keep their own journal header naming conventions to imported journals in Oracle GL for custom Journal sources. As I know while importing journals, Oracle Creates the Journal Name based on the

  • Forms 6i libraries in UNIX vs NT

    We are trying to compile forms under UNIX but are having problems with upper case and lowere case libraries. Basically forms are created in NT which is where we attach the libraries, save the fmb and ftp to UNIX and try to compile. Get errors indicat

  • Set up MAC Address Filtering on WRT54G - now nothing connects

    I set up MAC address filtering on the wireless router.  Added 5 MAC addresses to the PERMITTED list, by selecting them from the available devices.   Saved the changes.  Now, none of the machines can connect to the access point.  That includes the PC

  • Help, can't see my drives

    Hi all I have a problem that started with activating a new account on my computer for a friend to upload files as FTP. using DISK INFO, I tried to restrict my drive's persmissions, but then relized that it was restricting all users. When i logged out

  • CRM Survey Suit - Questionnaire

    I created a questionnaire and then translated it into German, Spanish and French.   I then activated the translations.  I now need to add additional questions/answers to the survey.  Is there a way to change the English version but not lose the trans