Passing date range parameters in MDX Query

Following is my mdx query
SELECT NON EMPTY
    [Measures].[Cache Attendees Count]
ON COLUMNS,
NON EMPTY
    ([Cache Attendees].[Visit Id].[Visit Id].ALLMEMBERS *
    [Cache Attendees].[User Id].[User Id].ALLMEMBERS *
    [Cache Attendees].[Screen Name].[Screen Name].ALLMEMBERS *
    [Cache Attendees].[User Type Id].[User Type Id].ALLMEMBERS *
    [Cache Attendees].[User Type Name].[User Type Name].ALLMEMBERS *
    [Cache Attendees].[Group Date Count].[Group Date Count].ALLMEMBERS *
    [Cache Attendees].[Insert Time Stamp].[Insert Time Stamp].ALLMEMBERS )
    DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM
    SELECT
            STRTOMEMBER(@FromCacheAttendeesInsertTimeStamp) : STRTOMEMBER(@ToCacheAttendeesInsertTimeStamp)
        ) ON COLUMNS FROM (
        SELECT
            STRTOSET(@CacheAttendeesConferenceId) ) ON COLUMNS FROM [Cube_Attendee])
        WHERE ( IIF( STRTOSET(@CacheAttendeesConferenceId).Count = 1, STRTOSET(@CacheAttendeesConferenceId), [Cache Attendees].[Conference Id].currentmember ) )
CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
I want to filter my cube with three parameters
1. @CacheAttendeesConferenceId
2. @FromCacheAttendeesInsertTimeStamp
3. @ToCacheAttendeesInsertTimeStamp
When i pass following parameters
ConferenceId = 1, StartDate='2010-01-28T00:00:00', EndDate='2010-02-03T00:00:00'
Then it show records
But When i pass following parameters
ConferenceId = 1, StartDate='2010-01-27T00:00:00', EndDate='2010-02-03T00:00:00'
Then it display message No Data Available
PLease help me on this issue why not FromDate & ToDate range works properly.

Step1:- First i create a SSAS datasource. Then i create a cube for my table CacheAttendees.
It has following columns:-
[Cache Attendees].[Conference Id]
[Cache Attendees].[Group Date Count]
[Cache Attendees].[Insert Time Stamp]
[Cache Attendees].[Screen Name]
[Cache Attendees].[User Id]
[Cache Attendees].[User Type Id]
[Cache Attendees].[User Type Name]
[Cache Attendees].[Visit Id]
Step2:- Then i create a dimension with this cube with all columns.
Step3:- Then i deploy my SSAS project.
Step4:- Use SSAS datasource in my SSRS datasource.
Step5:- Create a report with chart control. Add a parameter ConferenceId. Set default to 1. When i preview my report then it show Cache Attendees].[Conference Id].[1] in header of report instead of that, When i pass the parameter value as 1 then report cannot show & throw an error. I want to pass this parameter at runtime.
Step6:- Please help me how is it possible to pass parameter at runtime.

Similar Messages

  • Code or idea of adding date range parameters

    Thanks guys for answering all my past queries.
    Another question arises
    I don't know how to write code for date range value parameters for a report.
    i-e
    I have a report that takes a start date and end date range parameter.
    I can pass all the other parameters to CrystalReportViewer through code but dont know how to write code to pass date range parameters.
    Please help!

    Hi,
    I assume you are using JRC on CR XI or XI R2.
    For Single Range Values:
    Calendar calendar1 = Calendar.getInstance();
    calendar1.clear();
    calendar1.set(yyyy,mm,dd);
    Date date1 = calendar1.getTime();
    Calendar calendar2 = Calendar.getInstance();
    calendar1.clear();
    calendar.set(yyyy,mm,dd);
    Date date2 = calendar2.getTime();
    // use yyyy,mm,dd,hh,mm,ss for DateTime parameter.
    ParameterFieldValue rangeVal = createSingleRangeVal(date1, date2, RangeValueBoundType.inclusive, RangeValueBoundType.inclusive);
    paramFieldController.setCurrentValue("", "<Parameter Name>", rangeVal);
    For Multiple Range Values:
    Object [] beginVals = {date1, date2, date3};
    Object [] endVals = {date4, date5, date6};
    //Where  date1 - date4 is range 1, date2 - date5 is range 2 and date3 - date 6 is range 3.
    RangeValueBoundType [] beginBoundTypes = {RangeValueBoundType.inclusive, RangeValueBoundType.exclusive, RangeValueBoundType.noBound};
    RangeValueBoundType [] endBoundTypes = {RangeValueBoundType.noBound, RangeValueBoundType.inclusive, RangeValueBoundType.exclusive};
    ParameterFieldValue [] multiRangeVal = createMultiValRangeParameter(beginVals, endVals, beginBoundTypes, endBoundTypes);
    paramFieldController.setCurrentValues("", "<Parameter Name>", multiRangeVal);
    I hope this helps.
    Thanks
    Aasavari

  • Optional date range parameters

    Hi All,
    I have a 2 parameters from date and to date.When I didn't selected anything in parameters list then it should show all dates data.
    Please suggest how to create a optional parameter for date range parameters.

    Hi Sastry,
    For getting optional date parameter we are using formula like this  in record selection
    Not(hasvalue({?Date})) OR ({employee.Date} = {?Date})
    But the solution you provided doesn't contain not .Can you please suggest what is the difference.

  • Date parameters using MDX query

    Hello experts,
    Not sure if this question falls under SSAS or SSRS but I'm writing it here for now and hopefully get the answer.
    I'm using SSAS cube to develop a report using SSRS and this is the first time I'm doing it. I want to filter records based on date range and did some research online. My report contains two datasets:
    1. dsMain dataset -> it contains all the field which I want to use in the report and added a parameter thru query designed with following settings:
    Dimension : Dates
    Hierachary : Date
    Operator : Range (Inclusive)
    Parameters : checked
    it created two parameters called FromDatesDate and toDatesDate
    2. I created another dataset called dsDate and wrote a custom query (found at following link) and changed FromDatesDate and ToDatesDate using this date dataset
    https://jsimonbi.wordpress.com/2011/03/22/using-a-date-parameter-in-ssrs-with-mdx/
    Query for dsDate
    WITH
    MEMBER DateValue
    AS
       [Dates].[Date].CurrentMember.UniqueName
    MEMBER DateLabel
    AS
       [Dates].[Date].CurrentMember.Name
    SELECT
        [Measures].[DateValue],
        [Measures].[DateLabel]
    } ON 0,
         [Dates].[Date].[Date]
    } ON 1
    FROM [myCube]
    Here is the value returned by dsDate dataset (above query)
                            DateValue                          DateLabel
    06/04/1980 [Dates].[Date].&[29375]
    06/04/1980
    06/05/1980 [Dates].[Date].&[29376]
    06/05/1980
    06/06/1980 [Dates].[Date].&[29377]
    06/06/1980
    06/07/1980 [Dates].[Date].&[29378]
    06/07/1980
    06/08/1980 [Dates].[Date].&[29379]
    06/08/1980
    06/09/1980 [Dates].[Date].&[29380]
    06/09/1980
    06/10/1980 [Dates].[Date].&[29381]
    06/10/1980
    06/11/1980 [Dates].[Date].&[29382]
    06/11/1980
    06/12/1980 [Dates].[Date].&[29383]
    06/12/1980
    06/13/1980 [Dates].[Date].&[29384]
    06/13/1980
    Here is what I changed in FromDatesDate and ToDatesDate parmeter:
    Under Available Values tab:
    Dataset : dsDate
    Value Field : DateValue
    Label Field : DateLabel
    Here are my questions:
    1. I want to use date/time parameter so that user doesn't have to scroll thru whole date dimension.
    2. I changed the FromDatesDate and ToDatesDate to date/time parameter, removed the values from Available values tab and made the following changes on Parmaeters expression under dsMain dataset
    =”[Dates].[Date].&[” + Format(CDate(Parameters!FromDatesDate.Value),”MM/dd/yyyy”)
    + “T00:00:00]”
    =”[Dates].[Date].&[” + Format(CDate(Parameters!ToDatesDate.Value),”MM/dd/yyyy”)
    + “T00:00:00]”
    Now when I run the report I get following error:
    Query (1, 55) The restrictions imposed by the CONSTRAINED flag in the STRTOMEMBER function are violated.
    I think the reason is by changing parameter to date/time, now I cannot get "DateValue" which is required for the query.
    1. What is the best way to work with date parameters?
    Hope it is all clear and look forward to hear from experts.
    Thanks,
    P
    mark it as answer if it answered your question :)

    Hi Parry2k,
    In Analysis Services, a member can be referenced by either its member name or by its member key. The member key is used by the dimension to specifically identify a given member. The ampersand (&) character is used in MDX to differentiate
    a member key from a member name. In this scenario, the datetime is member name, not the member key. So you should not add "&".
    Reference:
    Member Names and Keys
    Simon Hou
    TechNet Community Support

  • Passing date range ??

    Post Author: hasan
    CA Forum: Formula
    I am using ASP.net and SQL server...  I have a Selection Formula, that works great when querying my table to generate the report.  I am clueless on how to produce a report based on a date range, that a user specifies in the textboxes.  I've tried the following with no success:
    mySelectFormula = "{ServiceRequest_Table.Dept_Name} = " & """" & Trim(ddlDepartment.SelectedValue) & """ AND {ServiceRequest_Table.Status_Type} = " & """" & Trim(ddlStatusType.SelectedValue) & """ AND {ServiceRequest_Table.UserFullName} = " & """" & Trim(ddlUser.SelectedValue) & """ AND {ServiceRequest_Table.Open_Date} > " & """" & Trim(txtFromDate.Text) & """"
    I get this error:
    A date-time is required here. Details: errorKind Error in File C:\Users\LCSGLO~1\AppData\Local\Temp\ServiceRequest_Temp_Report {37610816-196F-4EB1-8CB1-C80554C057FD}.rpt: Error in formula . '{ServiceRequest_Table.Dept_Name} = "IT Group" AND {ServiceRequest_Table.Status_Type} = "New" AND {ServiceRequest_Table.UserFullName} = "Hasan Mehmet" AND {ServiceRequest_Table.Open_Date} > "9/30/2007"' A date-time is required here. Details: errorKind
    Please any help in regarding this issue would be greatly appreciative.....it has been weeks and it's driving me crazy.
    Thanks!!

    Step1:- First i create a SSAS datasource. Then i create a cube for my table CacheAttendees.
    It has following columns:-
    [Cache Attendees].[Conference Id]
    [Cache Attendees].[Group Date Count]
    [Cache Attendees].[Insert Time Stamp]
    [Cache Attendees].[Screen Name]
    [Cache Attendees].[User Id]
    [Cache Attendees].[User Type Id]
    [Cache Attendees].[User Type Name]
    [Cache Attendees].[Visit Id]
    Step2:- Then i create a dimension with this cube with all columns.
    Step3:- Then i deploy my SSAS project.
    Step4:- Use SSAS datasource in my SSRS datasource.
    Step5:- Create a report with chart control. Add a parameter ConferenceId. Set default to 1. When i preview my report then it show Cache Attendees].[Conference Id].[1] in header of report instead of that, When i pass the parameter value as 1 then report cannot show & throw an error. I want to pass this parameter at runtime.
    Step6:- Please help me how is it possible to pass parameter at runtime.

  • Passing a portlet parameters on the Query String

    Hello,
    We have a portal page with a portlet on it and would like to be able to make this portlet dynamic by using additional parameters on the portal url query string.
    Back in version 5, I was told that this couldn't be done. Perhaps someone knows whether the G6 portal supports this?

    Yes, you can pass portal url into porlet in G6.
    1. You have to check box "HostPageURI" (don't remember exactly, but close to this one) on User Information page for Web Service.
    2.Use getHostPageURLQueryString() method (for IPortletRequest) to retrive QueryString value;
    3. Parse url value manualy to access parameters and values.
    But think twice before do this. This is because there are more effective ways to pass data and "make portlet dynamic":
    1) Portlet Settings (classic way, total page refresh);
    2) Adaptive portlets techology (inline refresh, passing data to other portlets on the same page);
    3) Portal Session object (for G6). Way to pass data to portlets placed on different page.
    Edited by Bryazgin at 01/18/2007 7:11 PM

  • Pass date range parameter  to SQL stored procedure.

    Hi,
    I'd like to pass a date range parameter from Crystal Reports to a sql stored procedure. Does anyone know if this is possible?
    I've had no problem passing standard datetime (single value) paramaters to and from but am struggling with getting a range value parameter to work.
    Environment: Crystal Reports 10/XI and SQL 2000 MSDE version or SQL 2005 Express Edition.
    Any help would be appreciated.

    C5112736 wrote:>
    > And then these 2 formulas 'Formula # 1' and 'Formula # 2' can be used to pass on to the stored procedure.
    Can someone please demonstrate exactly how to use formula results as date parameters to a SQL stored procedure?  Keep in mind, there are two parameters to the stored procedure.
    I have gleaned this much: Use Add Command and insert the procedure with
    EXEC ServerName.dbo.usp_sprocName;1 '{?StringParameter}'
    but if I try to do
    {CALL ServerName.dbo.usp_SprocName({@Formula1},{@Formula2})}
    then it gives the error "No value given for one or more required parameters". 
    Both of the parameters are VARCHAR(50).
    I have finally found this link: [http://msdn.microsoft.com/en-us/library/ms710248(VS.85).aspx|http://msdn.microsoft.com/en-us/library/ms710248(VS.85).aspx]
    This Microsoft site defines the format of the ODBC escape sequences, but I still do not know how to convince Crystal to insert it's parameter results or formula results.
    Pulling what's left of my hair out . . .
    ~ Shaun

  • How to pass date range as filter in Go URL

    Hi,
    I am trying to construct a Go Url which has two filters, date range & text. I have constructed the url as below but it keeps throwing an error. The url is not passing the max date and the application is throwing following error:
    Error: State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 46048] Datetime Month value 0 from 0000-00-00 is out of range. (HY000)
    Go Url: https:companyUrl?Go&Options=rfd&Path=/shared/CompanyID/Reportlink&P0=2&P1=eq&P2=CustomObject4.%22Indexed%20Pick%201%22&P3=Leasing&P4=bet&P5="- CustomObject4 Custom Attributes".ZDate_26&P6=2+Date%20'2014-08-01'+Date%20'2014-12-31'
    Please suggest.
    Thanks,
    Kiran.

    Looks like you are converting the datatype from char to date in URL, I dont think this can be done.
    Your code is like
    &P6=2+Date%20'2014-08-01'+Date%20'2014-12-31'
    It suppose to be &P6=2+2014-08-01+2014-12-31
    I would suggest to do the formatting for this filed using Column properties and try.
    Hope this helps, pls mark if it does ;)

  • How to pass dates as parameters in GO URL?

    Hi,
    Can we pass date values as parameters in GO URL?
    I have a date column in my source report that I would like to pass as filter parameter to target reports via GO URL. Could you please let me know the correct syntax if this is possible?

    How can i convert the CHAr to date in the target?? I am using the below syntax and it is receiving a value of 20-JUL-2011.
    '<a href="http://sunt2000-10.wfs.com:9704/analytics/saw.dll?GO&path=/shared/WFS%20Financials/WFS%20Business%20Aviation/WFS%20Business%20Aviation%20Retail%20Volume&Action=Navigate&P0=1&P1=eq&P2="WFS%20Day%20Date"."Calendar%20Date"&P3=' || CAST("WFS Day Date"."Calendar Date" AS CHAR)  || ' ">QTY(USG)</a>'
    I need to convert this as a DATE when navigating to a different page to pass as a parameter.

  • Howto add date range parameters to linechart?

    I'm using SQL Server 2014 and SSDT 12. I have a linechart generated using three fields - FCP, NFS (both integers) and TimeIndex (the datetime over 30 days).
    I see how to add parameters but how do I allow users to specify a date range? For example to only view data from 01/12/2014 - 07/12/2014.
    Thanks in advance
    Adam

    Found this myself eventually in case anyone else needs it:
    http://100rov.blogspot.co.uk/2012/12/create-calendar-parameter-with-start.html

  • Creating Date Range Parameters

    Hi,
    I have created the date range parameter using the parameter fields, but when I refresh the report the data does not get affected. It gives the same result as it would have given without the date parameter. What needs to be done in order for the parameter to actually work.?
    Thanks

    By adding a parameter you just defined a variable/ condition. Now when you want to display your results based on the values selected, you mean to implement a condition , similar to where clause in usual queries.
    For this we use the record selection formula, meaning to say the records would be selected based on those conditions.
    For eg. You are using the date range and you want to display data falling within those date range. That is you need to create a condition :
    1. What condition u2013 you have already created the parameters
    2. Implement that in where clause u2013 you need to create a record selection formula (menu Report -> Selection Formulas -> Record )
    You may probably need to use something like : in {?DateFrom} to {?DateTo}

  • Passing date over parameters

    Dear all,
    I have created a report which consists of 3 sub reports. All three sub reports uses different date fields from different tables (though the database is the same). The main report uses its own date field which is from another table.
    So, there are 4 reports in all
    Main Report takes date field from table A
    Sub Report 1 takes date field from table B
    Sub Report 2 takes date field from table C
    Sub Report 3 takes date field from table D
    Now when I run the main report, it asks me to input dates 4 places (total of 8 places where I have to replicate same date each time I run the report.
    Now to over come this I linked the Date parameters of the main report with the date fields of the sub reports.The problem occurs when the results are shown.
    All of the results are incorrect except the main report results.
    I am wondering how can I pass dates which I have entered into the main report parameter field to all sub report fields so that I don't have to enter dates 8 times each time I open a report.
    Here is the record selection formula for main report date field
    ({foccredsum.date_created} in {?Start Date} to {?End Date})
    Now for the sub reports the date fields are different.
    How can I integrate the date parameters?
    Regards
    Jehanzeb

    Hi J,
    Try the following :
    --Delete all Sub report parameters which you have created
    --Create From and To date parameters in Main report.
    --Place sub report and edit sub report links and select main report From parameter and link to sub report date field.
    Note : If you are not finding sub report date field while linking main report parameter then check the main / sub report date datatype.  (Both should have either Date or DateTime data type)
    --Please go in sub report and go in Record selection and check whether the parameter is filtering correct date or not.
    I think, in your case all date fields are not Date or DateTime.
    Hope this helps you
    Regards,
    Sastry

  • Range selection in MDX query

    Hello to everyone,
    Is there anyway to develop a MDX query, using a sap variable, and use the range interval at this query.
    For example, at BEX I can define a variable to accept year/month from xxx to yyy.
    How can I do this in MDX? I'm only able to execute only with a single value (like in this simple example). Is the other way possible?
    SELECT {[Measures].[3ZFR2WD9UJZZZBUBZNRGDIQ9X]}
    ON COLUMNS,
    NON EMPTY
    {[0SALESEMPLY].LEVELS(01).MEMBERS}
    ON ROWS
    FROM [YSD_M05/YSD_M05_Q0040]
    SAP VARIABLES
    [YKC_MESN] INCLUDING [0CALMONTH].[200503]
    Thanks and best regards from a cloudy day at Lisbon
    Bruno

    Hello,
    Ok... I just figured it out. We must use the ":" operator.
    The query must be like this:
    SELECT {[Measures].[3ZFR2WD9UJZZZBUBZNRGDIQ9X]}
    ON COLUMNS,
    NON EMPTY
    {[0SALESEMPLY].LEVELS(01).MEMBERS}
    ON ROWS
    FROM [YSD_M05/YSD_M05_Q0040]
    SAP VARIABLES
    [YKC_MESN] INCLUDING [0CALMONTH].[200503]:[0CALMONTH].[200504]
    Best Regards
    Bruno

  • Date format with BW MDX Query driver

    Hi,
    I have a question regarding the BW MDX Query driver.
    I have updated the driver from BW Query to BW MDX Query on my crystal reports and all the Date fields have been converted to Strings. Has anyone experienced the same issue?
    Thanks,

    Hi Abhilash
    Thanks for the reply. We have two different environments and are using Crystal XI R2 and Crystal 11. We have installed SAP Integration toolkit XI R2 and SAP GUI 7.1 Patch 14. The date issue is appening in both environments.
    Does MDX supports Date fields/formats?
    Thanks,

  • Dynamic date range creation for WebI query

    Hi
    I have a webi query where I need to provide a date range as selection.  But the from date will be based on number of days that user will provide during query execution. For e.g. user will give no of days as 10 so the date range need to be created as  (system date -10) to (system date).
    I am not sure how to provide the option for user to input no of days and then calculate the date range.
    Could you please help me here.
    Regards,
    Amit

    Amit.
    it can be done but by creating multiple objects.
    create Obj1: @prompt("Enter Number Of days",N,Mono,etc..) and capture the number of days in it.
    Create your second object infact a filter object: Obj2: Sysdate
    Third Object(filter) Obj3:  (Sysdate-(@select(class\Obj1)))
    give the between condition in webi using these two objects
    between Obj2 and Obj3

Maybe you are looking for

  • Migration of  Approved Invoices from 11i to R12

    Hi All, I am migrating all approved invoices from 11i to R12 using Invoice Interface tables and "Payables Open Interface Import" Concurrent program.But in R12 the Approval status changes and to "Required" and the Accounted status of distribution line

  • Idoc in sm 58 error in idoc to file

    hai friends iam doing file to idoc (matmas) secinario in that while sending idocs from sap system to xi system iam getting this error Transaction IDX1: Port SAPD40, client 151 destination  contain error in xi system alredy one more  matmas secinario

  • Problem in run Wcf service that published with Wizard

    hi i published my orchestration as wcf service with biztalk wcf service publishing wizard .it located in my IIS . but  any time  i try to access to tis wcfservice with my browser i just recive this error . where is the problem? Error: Server Error in

  • NMAKE: Fatal error U1052 file not found

    Hi On building the bios source with nmake.exe of visual studio 2013 express getting this error on command prompt.Please help me if u know the exact idea.

  • Apex and Natural Vs Surrogate keys

    Hi We've been using Apex for a few months now and there's a debate raging in our department over whether we should design our database tables using natural or surrogate (based on Oracle sequences / triggers) keys. Our experience as Apex developers sh