How to relate current day to date hierarchy [year - month - day] for SSRS report paramenter

Hi there: 
  I've created a SSRS report based on OLAP cube. In this report, there is a date parameter which is used to filter out data. 
Now , I want this report to be run and always retrieve data from previous day. I need to supply the date parameter with something
like SQL syntax: DATEADD(dd,-1,GETDATE())  . The question is how can I do that in the MDX world? 
 thanks
 Hui
--Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN --

Hi Hui,
According to your description, you need to retrieve data from previous day, so you are looking for an expression in MDX which can achieve the requirement like SQL syntax: DATEADD(dd,-1,GETDATE()), right?
As per my understanding, it easy to achieve this requirement in report level ranther than in MDX query level. You can create another hidden parameter "Date2" using the expression below.
=DateAdd("d",-1,Parameters!Date.Value)
Then use Date2 parameter to filter in the query.
If don't want to create another parameter, you can use it like below.
Year     =DatePart("yyyy",DateAdd("d",-1,Parameters!Date.Value))
Quarter  =DatePart("qq",DateAdd("d",-1,Parameters!Date.Value))
Month    =DatePart("mm",DateAdd("d",-1,Parameters!Date.Value))
Week     =DatePart("ww",DateAdd("d",-1,Parameters!Date.Value))
Besides, DateAdd function is supported in MDX, please refer to the link below.
http://msdn.microsoft.com/en-us/library/hh510163.aspx
If I have anything miunderstand, please point it out.
Regards,
Charlie Liao
If you have any feedback on our support, please click
here.
Charlie Liao
TechNet Community Support

Similar Messages

  • How to increase the number of data Business Object can pull for a report?

    Hi,
    I would like to ask around how to increase the number of data Business Object can pull for a report. I have a report which pulls data depending on the date range (ex. From 01/01/2007 - 01/10/2007). But, when the data that is pulled exceeds 5000, the report fails. Is there anyway to increase the number of data that BO can pull?
    Thanks

    Bobby,
       to my knowledge we can't change that. Let me explain this, we have setting in the source system for DS default Data Transfer. there we will assign the processes. if you want to assign 4 you need to change the setting in the source system. For flat files we can change in BW System. We can maintain the setting in the Infopackage level(wht we are assigned in the Source System), but we can't change the process.
    in order to check the setting in source system  SBIW--> General Settings --> Control Parameters for Data Transfer.
    we need to change here, this will effect to all the Data Sources. Before making changes check with your basis.
    All the best.
    Regards,
    Nagesh Ganisetti.

  • How to add a date(Year, Month, Day) table in OBIEE Administrator

    Hi,
    I am new to this tool, we are developing a HR report for emp on leave or absentees. we have data since 1982 in our tables. we want to have a date table and dimension where we can give have a hierarchy for year, month, day, so that we can design our dashboards based on time. how we can do that in OBIEE Administrator and can we do it in warehouse builder as well, if so, how. ( we have a column for date in the table by name 'leave start date' and 'leave end date', can we use this and create our own table with year month and day as separate columns).
    Thanks.

    hi,
    Using date column u can create time dim in BMM layer
    Create a new logical table and pull your date column to this table
    Next,create following columns
    Refer http://www.rittmanmead.com/2007/04/30/obi-ee-time-dimensions-and-time-series-calculations
    leave start date
    Year level :Extract(year from date_column)
    Month and year level:CAST (Extract(month from fact_date_column) As CHAR(5) ) || CAST (Extract(yearfrom fact_date_column) As CHAR(5) )
    Mon-YYYY: EVALUATE('TO_CHAR(%1,%2)' AS CHARACTER ( 30 ), "Development".""."sample sales"."Dim - leave Date"."REPORT_DATE", 'MON-YY')
    YYYY-MM : CAST ( EXTRACT( YEAR FROM "sample sales".""."sample"."Dim - Report Date"."LEAVE_DATE") AS CHARACTER ( 4 )) || '/' || CASE WHEN EXTRACT( MONTH FROM "sample sales".""."sample"."Dim - Report Date"."LEAVE_DATE") BETWEEN 10 AND 12 THEN CAST ( EXTRACT( MONTH FROM "sample sales".""."sample"."Dim - Report Date"."LEAVE_DATE") AS CHARACTER ( 2 )) ELSE '0' || CAST ( EXTRACT( MONTH FROM "sample sales".""."sample"."Dim - Report Date"."LEAVE_DATE") AS CHARACTER ( 1 )) END
    Year Quater :: EVALUATE('TO_CHAR(%1,%2)' AS CHARACTER ( 6 ), "sample sales".""."sample"."Dim -Leave Date"."REPORT_DATE", 'YYYY') || '0' || EVALUATE('TO_CHAR(%1,%2)' AS CHARACTER ( 6 ), "sample sales".""."sample"."Dim -Leave Date"."REPORT_DATE", 'Q')
    Day: EXTRACT(DAY FROM DATE_COLUMN)
    Thanks,
    Saichand.v

  • How to get the difference of two dates in years,months and days

    Hi friends,
    how to get the difference of two dates in years,months and days
    for ex 2 years 3 months 13 days
    select (sysdate-date_Start) from per_periods_of_service
    thanks

    Something like this...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select to_date('17-nov-2006','dd-mon-yyyy') as c_start_date, to_date('21-jan-2008','dd-mon-yyyy') as c_end_date from dual union all
      2             select to_date('21-nov-2006','dd-mon-yyyy'), to_date('17-feb-2008','dd-mon-yyyy') from dual union all
      3             select to_date('21-jun-2006','dd-mon-yyyy'), to_date('17-jul-2008','dd-mon-yyyy') from dual
      4             )
      5  -- end of test data
      6  select c_start_date, c_end_date
      7        ,trunc(months_between(c_end_date, c_start_date) / 12) as yrs
      8        ,trunc(mod(months_between(c_end_date, c_start_date), 12)) as mnths
      9        ,trunc(c_end_date - add_months(c_start_date, trunc(months_between(c_end_date, c_start_date)))) as dys
    10* from t
    SQL> /
    C_START_D C_END_DAT        YRS      MNTHS        DYS
    17-NOV-06 21-JAN-08          1          2          4
    21-NOV-06 17-FEB-08          1          2         27
    21-JUN-06 17-JUL-08          2          0         26
    SQL>But, don't forget that different months have different numbers of days, and leap years can effect it too.

  • How to get current time and date??

    How to get current time and date from my PC time and date to the java application??
    i use java.util.* package but got error, that is:
    - java.util.* and java.sql.* class are match
    - abstract class cannot be instantiated
    so what can i do, pls guide...thanks...

    There is a method in the System class that will return the current system time. You could also instantiate a Date, Time, Timestamp, or Calendar object, all of which get created with the system time by default.
    Don't import *. Import the specific classes you need.
    Next time, post the actual text of the exceptions/compile errors. If you make people guess, most just won't bother.

  • Find date if year, month, week and day is given

    Hi,
    How to find the date, if year, month, week and day is given?
    For example:
    Given, year - 2010, month - 03, Day - Wednesday, Week - 3,
    Then how can we get the date as 17-Mar-2010.
    Thanks,
    Chris

    with dt_tbl as (
                    select  2010 year,
                            3 month,
                            3 week,
                            'Wednesday' day
                      from  dual
    select  trunc(to_date(year || '-' || month || '-01','yyyy-mm-dd'),'iw') + (week - 1) * 7 +
              case day
                when 'Monday' then 0
                when 'Tuesday' then 1
                when 'Wednesday' then 2
                when 'Thursady' then 3
                when 'Friday' then 4
                when 'Saturday' then 5
                when 'Sunday' then 6
              end dt
      from  dt_tbl
    DT
    17-MAR-10
    SQL> SY.

  • Find year,month & day between dates

    Hi,
       I need to find a number of years, months & day between a given dates. For example If a employee joined on 31.01.2003 and left on 01.06.2006, I need to find in between how many years, months & days he has worked. Is there any function module available .

    DATA: EDAYS LIKE VTBBEWE-ATAGE,
    EMONTHS LIKE VTBBEWE-ATAGE,
    EYEARS LIKE VTBBEWE-ATAGE.
    PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
    TODATE LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
    Call Function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
      exporting
        i_date_from          = FROMDATE
        i_date_to            = TODATE
    *   I_FLG_SEPARATE       = ' '
      IMPORTING
        E_DAYS               = EDAYS
        E_MONTHS             = EMONTHS
        E_YEARS              = EYEARS.
    WRITE:/ 'Difference in Days   ', EDAYS.
    WRITE:/ 'Difference in Months ', EMONTHS.
    WRITE:/ 'Difference in Years  ', EYEARS.
    INITIALIZATION.
    FROMDATE = SY-DATUM - 60.
    Using teh abiove u can get difference but when u pass previous year u wont get the exact.
    There is no seperate FM for this, u have to use three FM.
    If possible using these three FM code u can create an FM.
    <b>For years and months between two days:</b>
    DATA:   EYEARS  LIKE VTBBEWE-ATAGE.
    PARAMETERS: FROMDATE LIKE PREL-BEGDA,
                     TODATE   LIKE PREL-BEGDA DEFAULT SY-DATUM.
    CALL FUNCTION 'COMPUTE_YEARS_BETWEEN_DATES'
      EXPORTING
        first_date                        = fromdate
    *   MODIFY_INTERVAL                   = ' '
        second_date                       = todate
    IMPORTING
       YEARS_BETWEEN_DATES               =  EYEARS
    * EXCEPTIONS
    *   SEQUENCE_OF_DATES_NOT_VALID       = 1
    *   OTHERS                            = 2
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Write:/ eyears.
    DATA:       EMONTHS LIKE VTBBEWE-ATAGE.
    PARAMETERS: FROMDATE LIKE SY-DATUM,
                TODATE   LIKE SY-DATUM
    DEFAULT SY-DATUM.
    CALL FUNCTION 'MONTHS_BETWEEN_TWO_DATES'
      EXPORTING
        i_datum_bis         = fromdate
        i_datum_von         = todate
    *   I_KZ_INCL_BIS       = ' '
    IMPORTING
       E_MONATE            = emonths
    write:/ emonths
    CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
    EXPORTING
    I_DATUM_BIS = x_faede-zfbdt
    I_DATUM_VON = p_fdat
    I_KZ_EXCL_VON = '0'
    I_KZ_INCL_BIS = '0'
    I_KZ_ULT_BIS = ' '
    I_KZ_ULT_VON = ' '
    I_STGMETH = '0'
    I_SZBMETH = '1'
    IMPORTING
    E_TAGE = dias_v.
    IF SY-SUBRC <> 0.
    ENDIF.
    x_faede-zfbdt -> 20050915
    p_fdat -> 20050811
    dias_v = 4
    try this and let me know.
    Message was edited by:
            Judith Jessie Selvi

  • Date difference in years,month,days should consider Leap Year

    I would like to know how to compute the difference between two Date, and get the difference in years,months,days, PS. Should include New Year
    Eg Date1 : 01/01/2000
    Date2: 01/01/2005
    Diff: years=5, months=0 days=1 for a leap year is included'2004'

    I would like to know how to compute the difference
    between two Date, and get the difference in
    years,months,days, PS. Should include New Year
    Eg Date1 : 01/01/2000
    Date2: 01/01/2005
    Diff: years=5, months=0 days=1 for a leap year is
    included'2004'If any program I was using gave me that result, I would consider it a bug.

  • How to get period date of for a given month from a given date in mdx for SSRS report (mm/dd/yyyy)

    I have a situation,  where i need to write expression Period to date(PTD). i want to know how to get the period date. i want you to help in writing Period date or else is there any function to get period date for a given date(the  date is given
    from the parameter dynamically) in MDX for SSRS report
    ram

    Hi ram,
    Per my understanding that you want to get the period date based on the month selected and the given date, right?
    Could you please provide details information below to help us better understanding your requirements, thus we will be more effective to provide an solution:
    What is the format of the period date you want to get, is this date in the DB and you want to filter it based on the month and the given Date?
    Did the month and given date are two parameters in the report? if possible, could you please provide some sample data in the DB and also the snapshot of the report structure
    I assume you want to get the period date(mm/dd/yyy) between the select month(e.g:Feb) and the given date (10/1/2014) and you should get the date between(02/01/2014-10/1/2014).
    If so,and you also have two parameter "Month","EndDate"(EndDate is the given date), please reference to details information below:
    You can create an new parameter "BeginDate" (Date/Time) which is the begin date of the period, you can use the expression to get the value based on the value of the month and the year value from the given date,finally hide this parameter:
    Specify the available value:
    Label:=Parameters!Month.Value &"/01/"& DatePart("yyyy",Parameters!EndDate.Value)
    Value:=CDate(=Parameters!Month.Value &"/01/"& DatePart("yyyy",Parameters!EndDate.Value))
    Specify the default Value:
    Value:=CDate(=Parameters!Month.Value &"/01/"& DatePart("yyyy",Parameters!EndDate.Value))
    Add filter to the dataset as below:
    Preview you will get all the date in the given Period:
    If you still have any problem, please feel free to ask.
    Regards
    Vicky Liu

  • Date separate year, month and day

    Hello everyone and thanks in advance, I'm new to this and the truth is not doing this.
    Well, I have a PDF with several pages which I designed and has been asking me in a complete date in the format dd / mm / yy and subsequent pages he asks me the same date of birth but in 3 separate fields, day , month and year. I want you when you enter the date the first copy and separate day month and year in others. I tried this but I get
    var array_datesol = datesol.split("/")
    var year = parseInt(array_datesol[2]);
    var month = parseInt(array_datesoll[1]);
    var day = parseInt(array_datesol[0]);
    this.getField('yearsol').value = year;
    this.getField('monthsol').value = month;
    this.getField('daysol').value = day;
    where is the initial field datesol date and year, month and day where they have to be separately
    thanks in advance

    Are you getting any errors in the JavaScript debugging console?
    You are using the syntax for the 'Custom JavaScript calculation' and this syntax can not be used in the 'simplified field notation. Also you can not use any JavaScript properties, objects, functions, control statments.
    When run in the console, I find you have a misspelling of the variable name 'datesol'. I also do not see where you are initializing the value for 'datesol'.
    var datesol = event.valueAsString;  // get value of this field
    var array_datesol = datesol.split("/") ; // make into an array
    this.getField('yearsol').value =array_datesol[2];  // get element year
    this.getField('monthsol').value = array_datesol[1];  // get month element - fixed variable name
    this.getField('daysol').value = array_datesol[0]; // get date element
    I would use one of the following so the other fields are only updated when a date has been entered and the leading zeros are displayed:
    this.getField('yearsol').value = '';
    this.getField('monthsol').value = '';
    this.getField('daysol').value = '';
    if(event.value != '') {
    // get parts of date and print with leading zeros
    var datesol = event.value;  // get value of this field
    var array_datesol = datesol.split('/') ; // make into an array
    this.getField('yearsol').value = util.printf('%,304.0f', array_datesol[2]);  // get element year
    this.getField('monthsol').value = util.printf('%,302.0f', array_datesol[1]);  // get month element - fixed variable name
    this.getField('daysol').value = util.printf('%,302.0f', array_datesol[0]); // get date element
    // or
    this.getField('yearsol').value = '';
    this.getField('monthsol').value = '';
    this.getField('daysol').value = '';
    if (event.value != '') {
    // get date parts and print with leading zeros
    var oDatesol = util.scand('dd/mm/yyyy', event.value); // get date object
    this.getField('yearsol').value = util.printf('%,302.0f',oDatesol.getFullYear());  // get element year
    this.getField('monthsol').value = util.printf('%,302.0f', oDatesol.getMonth() + 1);  // get month element - fixed variable name
    this.getField('daysol').value = util.printf('%,302.0f', oDatesol.getDate()); // get date element
    // or
    this.getField('yearsol').value = '';
    this.getField('monthsol').value = '';
    this.getField('daysol').value = '';
    if(event.vaue != '') {
    // get parts of date and format
    var oDatesol = util.scand('dd/mm/yyyy', event.value); // get date object
    this.getField('yearsol').value = util.printd('yyyy', oDatesol); // get element year
    this.getField('monthsol').value = util.printd('mm', oDatesol); // get month element - fixed variable name
    this.getField('daysol').value = util.printd('dd', oDatesol); // get date element
    If you are going to fill other field, you will need to use the '.valueAsStriing' property or '.toString()'  method to retain the leading zeros.

  • Please help.........how can i get the last date of the month?????

    Hello....
    I want to get the last date of the month.
    For example, the last date of Jan is 31.
    How can I get the last date of the particular month and year ????
    Thanks for help.
    Gloria

    Hi Gloria
    1. How can I compare the date???date1.compareTo(date2)
    where date1 and date2 is a java.util.Date Object
    will return 0 if it is the same date
    or
    date1.after(date2)
    where date1 and date2 is a java.util.Date Object
    will return true if date1 is after date2
    (the same for date1.before)
    2. How can I change the date format into yyyymmdd format???? I just want the year, month and date.try the java.text.SimpleDateFormat Object
    new SimpleDateFormat("yyyymmdd").format(yourdate)
    Hope this help.
    Please also have a look at a calendar I wrote, (maybe it help)
    demo & source :
    http://www.geocities.com/globe_software/java/components/
    globe_sa

  • Creating Hierarchy Year-Month-Week-Dayof Week.

    Hi,
    We have a requirement to create new HR report - Labour Efficiency.
    We require 'Date of work' in BI report.
    It takes value from CATSDB table, WORKDATE field in R/3. Its Data Type- DATS , Integer length 16, output length 10.
    But in BI report they want hierarchy Year-Month-Week-Dayof Week  for this 'Date of work' field.
    How this can be achieved?
    Edited by: Amruta_Kedar on Sep 6, 2011 8:18 AM

    Hi Dilek,
    I have checked out the link and procedure given.
    I have never used this option neither any of the time hierachie is active in our system. Could you please elaborate how we used these hierarchies in BEx?
    I am confused which hierachy is to be selcted here. I didnt find any hierarchy Year-Month-Week-Dayof Week.
    Also, where do we activete these hierarchies (R/3 or BI side) ?
    Another question : 'Date of work' infoobject should be a characteristic of type DATS or a key figure of type DATE??
    which option will be better to do this kind of analyis on date?

  • How to use a table- valued function as a datasource for SSRS report?

    CREATE FUNCTION [dbo].[GetNetSheetRegionNetPerCapitaRow](@WeekBeginDate smalldatetime)
    RETURNS @RegionNetPerCapitaRow TABLE 
    (WTD1 DECIMAL(18,6),PYWTD1 decimal(18,6),percentDiff1 float,diff1 float,WTD2 decimal(18,6),YTD2 decimal(18,6),percentDiff2 float,Diff2 float,YTD3 decimal(18,6),PYTD3 decimal(18,6),percentDiff3 float,Diff3 float)
    how to use the above function as a data source for SSRS report instead of a stored procedure ?

    Hi,
    In the Dataset - > Query Type - >  Text - >
    SELECT * FROM [dbo].[GetNetSheetRegionNetPerCapitaRow](@WeekBeginDate)
    sathya - www.allaboutmssql.com ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.

  • I refuse to pay for a one year automatic subscription for Cosumer report that was charged to my account today without me noticing. How can I cancel that and get reimbursed now?

    I refuse to pay for a one year automatic subscription for Cosumer report that was charged to my account today without me noticing. How can I cancel that and get reimbursed now?
    Patrick

    First turn off auto-renewing subscriptions:
    iTunes Store: Purchasing and managing auto-renewing subscriptions
    Getting a refund won't be as simple. For that you will have to contact iTunes Store Support.

  • How to automatically update the Expiry Date's number of days

    My web app input form is an event submission form. Users enter the event title, event date and other details, etc. I've figured out how to get the "expiry days" in the form and it be hidden but i can't figure out how to calculate this:
    (today's date) - (event date) + 1 day = number of days to expire and then set the expiry days to that value upon submission.
    I have tried writing the js but am getting no where, has anyone out there already accomplished this? I've researched and researched and find a million things on calculating the number of days but can't get one of them to work for my situation here... any help would be greatly appreciated!!

    Hi Murtuza,
    You can use function module BAPI_ISUACCOUNT_CHANGE.
    Pass dunning lock details in parameter TCTRACLOCKDETAIL. This function module only create and delete locks.
    So, you need to pass existing lock details (from table DFKKLOCKS) with PROCESSING_MODE = 04 (delete) and append another value with changed expiry date with PROCESSING_MODE = 01 (Create).
    This will also help in maintain lock history too.
    Hope this helps.
    Regards,
    Avinash

Maybe you are looking for

  • PSE 12 for Mac doesn't see my scanner

    PSE12 for Mac refused to work with my scanner. In preferences I checked "Additional Plug-Ins Folder" and selected the Optional Plug-Ins Folder which contains the TWAIN.plugin. I restarted the PSE and the File> Import... command remains dimmed out. Tr

  • LBACSYS account not present on 11.2.0.3

    I installed OLS , VPD and Advanced Security ( its installed default anyway) and I verified using runInstaller that they are installed. But when checking the user presence, i dont see the account, and furthermore, SQL> SELECT VALUE FROM V$OPTION WHERE

  • UNIX Command to run cron jobs

    Is there a UNIX command I can send to the target machines to force them to run the 'Daily, Weekly, & Monthly' cron jobs? Do you guys know of a place that I can find useful commands to send to the machines?

  • Applet - JavaPurse does not have a public constructor

    Hello, I'm starting playing with Javacard and I tried to compile a demo of Java purse Applet. I can compile it withou problem but once I try to start it with JBuilder 2006 I get the following error : The applet com.sun.javacard.samples.JavaPurse.Java

  • Desktop Mode (Premier Pro CS5)

    I recently had a project that was nearly done and the first time I installed Adobe Premier Pro CS5, everything worked perfectly. Until recently, I had to reinstall the software and all of a sudden, it would only open in "Desktop Mode." All the video