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

Similar Messages

  • IIf condition between dates using mdx query

    Hi,
    how to check IIF condition between dates using mdx query.
    I able to check single year,plese check below mdx query.I need to check members between years.
    my requirement is member is belongs to between years(2007 to 2010),display "yes" else "NO";
    Could you please give me exact mdx query.
    From,to-2007,2010,if member belongs to 2007to 2010 then disply "yes"else "no".
    how to pass two members in IIf condition.
    WITH
    MEMBER Measures.[test]
    AS Iif([Date].[Calendar Year].currentmember
    is [Date].[Calendar Year].&[2007],"no","yes")
    SELECT {Measures.[test]}
    on 0
    ,[Product].[Subcategory].[Subcategory].MEMBERS * [Date].[Calendar Year].[Calendar Year]
    ON 1
    FROM [Adventure Works]
    indu

    Hi Sriindu,
    consider the following:
    WITH
    MEMBER measures.[test] AS
    IIF
    Exists
    [Date].[Calendar Year].CurrentMember
    [Date].[Calendar Year].&[2007] : [Date].[Calendar Year].&[20010]
    ).Item(0)
    IS
    [Date].[Calendar Year].CurrentMember
    ,"yes"
    ,"no"
    SELECT
    {measures.[test]} ON 0
    [Product].[Subcategory].[Subcategory].MEMBERS
    [Date].[Calendar Year].[Calendar Year] ON 1
    FROM [Adventure Works];
    Philip,

  • Using mdx query from Java Apache

    Please suggest/guide me how to use MDX query to pull data from cube from Apache JAVA??
    BI GUY

    Hi BIGUY,
    Multidimensional Expressions (MDX) is the query language that you use to work with and retrieve multidimensional data in Microsoft Analysis Services. MDX is based on the XML for Analysis (XMLA) specification, with specific extensions for SQL Server Analysis
    Services.
    According to your description, it's hard to give your the exact MDX query to pull the data which you want from the cube since there are no any detail information about the cube. Here are some basic knowledge for your reference.
    Querying Multidimensional Data with MDX
    MDX Sample
    Regards,
    Charlie Liao
    TechNet Community Support

  • Except function with parent child hierarchy using mdx query

    HI,
    I need to remove some items using mdx query in parent child hierarchy.
    I tried with below query,it is not removeing ,could you please help me.
    SELECT
    {[Measures].[Amount]} ON
    COLUMNS
     NonEmpty([Account].[Accounts].[Account Level 01],[Measures].[Amount])
    ON ROWS
    FROM (SELECT
    -Descendants({[Account].[Accounts].&[47]},,Leaves)
    } ON COLUMNS
    FROM [Adventure Works])
    indu

    Hi Indu,
    Why do you remove some itmes using
    Descendants function? Generally, we use FILTER function to achieve the requirement.
    WITH SET [CustomAccounts] AS
    FILTER ([Account].[Accounts].[Account Level 01].Members , [Account].[Accounts].CurrentMember.Name<>'Net Income')
    SELECT {[Measures].[Internet Sales Amount]} ON 0
    [CustomAccounts] ON 1
    FROM [Adventure Works]
    WITH SET [CustomAccounts] AS
    FILTER ([Account].[Accounts].[Account Level 01].Members , [Account].[Accounts].CurrentMember.Name='Net Income')
    SET [RemainingAccount] AS
    [Account].[Accounts].[Account Level 01]- [CustomAccounts]
    SELECT {[Measures].[Reseller Sales Amount]} ON 0
    [RemainingAccount] ON 1
    FROM [Adventure Works]
    Results.
    References.
    http://www.databasejournal.com/features/mssql/article.php/3306101/MDX-Essentials-Basic-Set-Functions-The-Filter-Function.htm
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/c0149678-97f2-4066-903f-7f9e9ff09b56/filtering-out-dimension-members-with-mdx?forum=sqlanalysisservices
    Regards,
    Charlie Liao
    If you have any feedback on our support,
    please click here.
    Charlie Liao
    TechNet Community Support

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

  • Controling Date Parameters using SRW.DO_SQL in Reports!

    Hello Friends,
    I Need to Control the Date Parameters in Reports.
    (Dev/2000 rel2.1) In SRW.Do_SQL package
    For Example:
    'Insert into x
    select * from Y
    where Y.date between f_date and t_date';
    Here: X,Y are two tables
    f_date and t_date are two different date parameters in
    format (dd-mm-yyyy).
    NOTE: Without these two date parameters, the Query is working
    fine. But I need to Use these Parameters. Could You Please find a
    solution for Me. Thanks in advance.
    Regards
    Manoj (India)
    (Dt:18thNov'99)
    null

    Manoj (guest) wrote:
    : Hello Friends,
    : I Need to Control the Date Parameters in Reports.
    : (Dev/2000 rel2.1) In SRW.Do_SQL package
    : For Example:
    : 'Insert into x
    : select * from Y
    : where Y.date between f_date and t_date';
    : Here: X,Y are two tables
    : f_date and t_date are two different date parameters
    in
    : format (dd-mm-yyyy).
    : NOTE: Without these two date parameters, the Query is working
    : fine. But I need to Use these Parameters. Could You Please
    find a
    : solution for Me. Thanks in advance.
    : Regards
    : Manoj (India)
    : (Dt:18thNov'99)
    Hi Manoj
    your goal is to supply all three as dates (y.date, f_date,
    t_date). if some of them are not date but char, varchar, ...
    then use to_date conversion function with proper format mask.
    hope this helps.
    null

  • SSRS report using mdx query to display sales of product by yearwise

    There is a requirement to create SSRS report as 
    Product                         +Calender2011               -Calender 2012            +Calender 2013      
             + Calender 2014
    Jan12 Feb12 Mar12...
    Product 1 50    100       200 ..
    Product 2 150    900       200 ..
    Product 3 250    180       900 ..
    Product 4 450    100       200 ..
    Product 5 50    100       200 ..
    Product 6 50    100       200 ..
    When I click on Calender2011 corresponding all months of 2011 has to appear and likewise for Calender2012, CalenderN 
    The MDX query I have like as follows-
    Select    Non Empty{
    [Measures].[Product1], 
     [Measures].[Product2], 
     [Measures].[Product3], 
     [Measures].[Product4],
      [Measures].[Product5], 
      [Measures].[Product6], 
      [Measures].[Product7], 
      [Measures].[Product8], 
      [Measures].[Product9], 
      [Measures].[Product10], 
      [Measures].[Product11], 
       } ON Rows ,
       Non Empty  { ([Dim Calendar H].[Year Name].[Year Name] ) *([Dim Calendar H].[Month name].[Month name])
     ON COLUMNS
      FROM ( SELECT ( { [Dim Calendar H].[Year Name].&[Calendar 2014], 
     [Dim Calendar H].[Year Name].&[Calendar 2013], 
     [Dim Calendar H].[Year Name].&[Calendar 2012], 
     [Dim Calendar H].[Year Name].&[Calendar 2011] } ) 
     ON COLUMNS 
     FROM [Cube]) 
    Please help me. 
    Advance thanks...

    Hi Afans,
    According to your description, you want to create a drill-down report using SQL Server Analysis Services database, right?
    In this case, you need add the Year and Month fields to the column group, and set the Month column can be toogled by Year column group. I have teste it on my local environment, here is the sample query for your reference.
    select [Measures].[Internet Sales Amount] on 0,
    [Product].[Category].members*[Date].[Calendar].[Calendar Year].members*[Date].[Month of Year].members on 1
    from
    [Adventure Works]
    Reference
    http://popbi.wordpress.com/2012/03/02/ssrs-how-to-add-a-column-group-to-an-existing-table/
    http://msdn.microsoft.com/en-IN/library/dd207042.aspx
    Regards,
    Charlie Liao
    TechNet Community Support

  • Using MDX query in RPD

    I have a MDX query that I want to use in the RPD as "Table Type" =Select
    I did create a new object as "Physical Dimension" and gave the below script as Essbase 11 specific SQL, but this does not work and an getting the generic error "[nQSError: 15002] Missing navigation space for subject area test. (HY000)". Any Idea as to how to use the MDX in RPD?
    MDX Script:
    with set classes as '{[Class_Data],[Inventory_Class_Data]}'
    set ledgers as '{[Actuals_Ledger],[Finance_Ledger],[Reclass_Ledger],[Allocation_Ledger],[Blending_Ledger],[HCSADJ_Ledger]}'
    set bu as '{[UTHCS],[UTMBG],[CONSL]}'
    set account as 'Except ({filter ([Accounts].Levels(0).members, IsAncestor([SRECNA],[Accounts].CurrentMember)),
    filter ([Accounts].Levels(0).members, IsAncestor([MISC_AUDIT],[Accounts].CurrentMember)),
                                      filter ([Accounts].Levels(0).members, IsAncestor([SNA],[Accounts].CurrentMember))},{[Change in Net Assets and Restatements]})'
    set funds as '{filter ([Fund].Levels(0).members,IsAncestor([All_Funds],[Fund].CurrentMember)),
    filter ([Fund].Levels(0).members,IsAncestor([Do Not Use Funds],[Fund].CurrentMember))}'
    select {[Act]} on columns,
    Non Empty (CrossJoin(CrossJoin(
    CrossJoin(account,funds),
    CrossJoin(ledgers,bu)
    ),classes)
      ) on rows
    from [finrpt15.work]
    where (FY15,YTD_Apr,UTMB_INSTITUTION);
    Thanks,
    Ravi

    Hi BIGUY,
    Multidimensional Expressions (MDX) is the query language that you use to work with and retrieve multidimensional data in Microsoft Analysis Services. MDX is based on the XML for Analysis (XMLA) specification, with specific extensions for SQL Server Analysis
    Services.
    According to your description, it's hard to give your the exact MDX query to pull the data which you want from the cube since there are no any detail information about the cube. Here are some basic knowledge for your reference.
    Querying Multidimensional Data with MDX
    MDX Sample
    Regards,
    Charlie Liao
    TechNet Community Support

  • Data pump using table query

    I am trying to perform a data pump export on a table using a query within a parfile and I am getting some odd behaviour. The database version is 10.2.0.4.3 and the OS is AIX 5.3. The query looks like this.
    QUERY="POSDECLARATIONQUEUE:where SESSIONID in (select 'B.SESSIONID' from POSACCOUNT A, POSDECLARATIONQUEUE B, POSDECLARATIONSESSION C where 'B.SESSIONID' = 'C.ID' and 'C.ACCOUNTID' = 'A.ID' and 'A.SITE' = '10252')"
    This works but gets 0 rows. If I run the query against the instance in an SQLPlus session as below then I get 0 rows returned.
    select * from POSDECLARATIONQUEUE where SESSIONID in (select 'B.SESSIONID' from POSACCOUNT A, POSDECLARATIONQUEUE B, POSDECLARATIONSESSION C where 'B.SESSIONID' = 'C.ID' AND 'C.ACCOUNTID' = 'A.ID' and 'A.SITE' = '10252');
    If I take out the single quotes from around the columns within the query against the instance within SQLPlus, I get over 2000 rows returned.
    SQL> select count(*) from POSDECLARATIONQUEUE where SESSIONID in (select B.SESSIONID from POSACCOUNT A, POSDECLARATIONQUEUE B, POSDECLARATIONSESSION C where B.SESSIONID = C.ID and C.ACCOUNTID = A.ID and A.SITE = 10252);
    COUNT(*)
    2098
    If I remove the single quotes from the parfile query then I get the following error within the data pump export.
    UDE-00014: invalid value for parameter, 'schemas'.
    The SCHEMAS option is not specified within the parfile and the TABLES option only specifies the table POSDECLARATIONQUEUE.
    Can someone assist with this, I just can't seem to be able to get the syntax right for it to work within data pump.
    Kind Regards.
    Graeme.
    Edited by: user12219844 on Apr 14, 2010 3:34 AM

    It looks like your query might be a little wrong:
    This is what you have:
    QUERY="POSDECLARATIONQUEUE:where SESSIONID in (select 'B.SESSIONID' from POSACCOUNT A, POSDECLARATIONQUEUE B, POSDECLARATIONSESSION C where 'B.SESSIONID' = 'C.ID' and 'C.ACCOUNTID' = 'A.ID' and 'A.SITE' = '10252')"
    This is what I would have thought it should look like:
    QUERY=POSDECLARATIONQUEUE:"where SESSIONID in (select B.SESSIONID from POSACCOUNT A, POSDECLARATIONQUEUE B, POSDECLARATIONSESSION C where B.SESSIONID = C.ID and C.ACCOUNTID = A.ID and A.SITE = 10252)"
    You want double " arount the complete query, and you don't need the single ' around all of the =. The single ' are treating those values as strings and it says
    'B.SESSIONID' = 'C.ID'
    is the string B.SESSIONID equal to the string C.ID
    In your query that you used in sql was
    B.SESSIONID = C.ID
    which says is the value stored B.SESSIONID equal to the value stored at C.ID
    Which is what you want.
    Dean

  • Checking correct data format using sql query

    1) I got column date of joining which accepts date in below format
    DD-MON-YYYY
    DD-MON-YY
    MON-DD-YYYY
    MON-DD-YY
    Month DD,YYYY
    Question:- how do i check whether all dates in Date of joining column are in above format or not using sql query?
    2) I got one more date column which accepts date in below format
    MMDDYYYY
    YYYYMMDD
    MM/DD/YYYY
    MM/DD/YY
    YYYY/DD/MM
    Question:- how do i check whether all dates in date column are in above format or not using sql query?
    sorry if it is a very simple question since I am new to sql and trying to learn ......Thanks for the answers from the group............

    In short, NO, it's not possible.  If you store dates correctly in the database as DATE datatype then you don't have this problem.  If you store them as VARCHAR2 you have a problem.
    So, you get a date of 20092012
    Is that 20th September 2012?  or is it 20th December 2009?
    What about...
    11-Jan-12
    Is that 11th January 2012 or 12th January 2011?
    Dates should never be stored on the database as strings.  That is why Oracle gives you a DATE datatype so you can store them properly.
    Also, when dates are passed from an application to the database, the application should be passing them as DATE datatype, and the application interface should be designed to accept dates from the user in a format specific to their country/locality and it would then know what that format is and automatically convert it to a DATE datatype before it gets anywhere near the database or any SQL.

  • TopLink doesn't sort data received using Named query

    Hello!
    I'm trying to build a Tree table using a TopLink Named query in my application.
    There are Id, Parent|_Id, Code and Name columns in the corresponding database table, where Id and Parent|_Id are linked together by Foreign key (typical tree). I used TopLink to describe this table in the Model part of my application. There I wrote a Named query, without using a query constructor (not Expression radio button, but SQL radio button). Here the text of query:
    select * from regions a connect by prior a.Id = a.Parent_Id start
    with a.Id is null order by a.Code
    Then I created a Data control and tried to build a JSF page with data based on this query, as tree-table.
    But I discovered the fact, that data under the same node on the same leaf level of the Tree are not sorted by code on the JSF page. For example, data may be situated as follows (Code - Name):
    2. wwwwwwwwwwww
    2.3.kkkkkkkkkkkk
    2.1.fffffffffffffffffffff
    2.2.oooooooooo
    1. qqqqqqqqqqqqqqqq
    1. 2. lllllllllllllllllllllllllllll
    1. 1. hhhhhhhhhhhhhh
    etc.
    I verified this query on other environment (PL/SQL Developer, SQL+), but didn't found such unsorted results anywhere.
    Please, give me an advice to avoid this problem.
    Thanks.

    Hi
    Something to do with TreeMap(TreeSet). I tried with TreeSet but it didn't work. Here is the code :
    In servlet :
    Connection lConnection = getConnection(pRequest);
    String lSQL = "";
    Statement lStatement;
    ResultSet lResultSet;
    Hashtable lLtypeHashtable = new Hashtable();
    lStatement = lConnection.createStatement();
    lSQL = "SELECT RCID,RCMEANING FROM REFERENCECODES WHERE RCDOMAIN = 'LOCATIONTYPE' AND RCROWSTATE > 0 order by RCMEANING";
    lResultSet = lStatement.executeQuery(lSQL);
    while(lResultSet.next())
    String lRcid = lResultSet.getString(1);
    String lRcmeaning = lResultSet.getString(2);
    lLtypeHashtable.put(lRcid.trim(),lRcmeaning.trim());
    if(lResultSet != null) lResultSet.close();
    if(lStatement != null) lStatement.close();
    pRequest.setAttribute("LtypeHashtable",lLtypeHashtable);
    //Below Query is executed when one data from select element is selected
    String lLType = DisplayUtilities.getString(pRequest.getParameter("LType"),true);
    //LType is name of select element in JSP.
    if (lLType != null)
    lSQL = lSQL + " AND " + lUpperCaseFunction + "(LOCATIONTYPE)" +
    " = " + DBUtilities.formatString(lLType.toUpperCase());
    pRequest.setAttribute("rLType",lLType+"");
    In JSp :
    <%
    Hashtable lLtypeHashtable = (Hashtable)request.getAttribute("LtypeHashtable");
    %>
    <TR>
    <TD width="15%"> <div align="left">
    <select name="LType" size="1" >
    <option Value="">< Select ></option>
    <%
    if(lLtypeHashtable != null)
    Enumeration enum = lLtypeHashtable.keys();
    while(enum.hasMoreElements())
    String key = (String)enum.nextElement();
    String value = (String)lLtypeHashtable.get(key);
    String flagBack = "";
    if(key.equals((String)request.getAttribute("rLType")))
    flagBack = "selected";
    %>
    <option Value="<%=key%>" <%=flagBack%>><%=value%></option>
    <%
    %>
    </select></div>
    </TD>
    </TR>
    How should I implement TreeSet?
    Looking forward for an early reply.
    Thanks.

  • Data Template using sql query

    Hi All,
    I'm trying generate xml data using data template approach. For this do i need to use XSQL to generate xml data?
    Can some one please tell me what is this XSQL and how it works?
    Thanks in advance,

    Hi Srini,
    Thank you very much for the link, its elucidates the xml data generation process using data template.
    One more question: is this method called (uses) XSQL anywhere??
    Thanks,

  • How to compare MoM using MDX Query

    Hello,
    I have a cube which I want to use  to compare MoM. 
    Example:
    Start Date : Jan 1 2015
    End Date : Jan 31 2015
    compare again Dec 1 2014 and Dec 31 2014
    Report will look like like:
                              Sales
                              Jan 1 - Jan 31 2015            Dec 1 - Dec 31 2014     Variance              % Variance
    Product A               100                                       200                  
         -100
    Product B                50                                         40              
                10
    Wondering how this can be achieved SSAS.
    Thanks,
    P
    mark it as answer if it answered your question :)

    Hello,
    Thanks for the reply. I is surely helpful but here is the next challenge I have in this:
    Just to give a run down, let's say user want to run a data for following date and want multiple comparison based on the date:
    For example date entered by user is Jan 14, 2015 and he want to see the data
    Jan 01 - Jan 14th  for the MTD For Jan 2015
    Dec 01 - Dec 14th for previous month
    Oct 16 2014 to Jan 14 2015 (previous 90 days from Jan 14 2015)
    Sep 15 2014 to Dec 14 2014 (previous 90 days from last date of previous month which is Dec 14th in this case)
    Just wondering if this kind of date range can be calculated on fly to get the data.
    Thanks,
    P
    mark it as answer if it answered your question :)

  • How to display last 10 minutes data  only using sql query

    Hi,
    Presently, I'm using version is,
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE 11.1.0.6.0 Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    So, please consider SCOTT Schema to resolve my issue,
    I want to display only last 10 minutes what records are inserted or updated or deleted.
    Please provide in many ways!!
    ThankQ!!

    Hi,
    See below:
    select
    from
      emp
    EMPNO ENAME      JOB        MGR HIREDATE      SAL    COMM DEPTNO
    7369 SMITH      CLERK     7902 17-DEC-80     800             20
    7499 ALLEN      SALESMAN  7698 20-FEB-81    1600     300     30
    7521 WARD       SALESMAN  7698 22-FEB-81    1250     500     30
    7566 JONES      MANAGER   7839 02-APR-81    2975             20
    7654 MARTIN     SALESMAN  7698 28-SEP-81    1250    1400     30
    7698 BLAKE      MANAGER   7839 01-MAY-81    2850             30
    7782 CLARK      MANAGER   7839 09-JUN-81    2450             10
    7788 SCOTT      ANALYST   7566 19-APR-87    3000             20
    7839 KING       PRESIDENT      17-NOV-81    5000             10
    7844 TURNER     SALESMAN  7698 08-SEP-81    1500       0     30
    7876 ADAMS      CLERK     7788 23-MAY-87    1100             20
    7900 JAMES      CLERK     7698 03-DEC-81     950             30
    7902 FORD       ANALYST   7566 03-DEC-81    3000             20
    7934 MILLER     CLERK     7782 23-JAN-82    1300             10
    14 rows selected
    select
    from
      emp
    minus
    select
    from
      emp
       as of timestamp (systimestamp - interval '10' minute)
    EMPNO ENAME      JOB        MGR HIREDATE      SAL    COMM DEPTNO
    0 rows selected
    update
      emp
    set
      ename = ename || ' x'
    where
      empno = 7934
    --1 rows updated.
    select
    from
      emp
    minus
    select
    from
      emp
       as of timestamp (systimestamp - interval '10' minute)
    EMPNO ENAME      JOB        MGR HIREDATE      SAL    COMM DEPTNO
    7934 MILLER x   CLERK     7782 23-JAN-82    1300             10
    */For changes, deletes and inserts compair the two result (emp and emp as of timestamp (systimestamp - interval '10' minute) ) with each other.
    Regards,
    Peter

  • MDX query To get DateKey based on my Dimension table

    Hi,
    In my Date dimension table DateKey will be 1,2,3,4........
     DateKey 1= 22nd Jan,2010
     DateKey 2= 23rd Jan,2010
     DateKey 3= 24th Jan,2010.
    Now i want to get Today date(Ex.22jan2014) and LastYearSameDay date(Ex.23jan2014) by using mdx query.
    Can you please suggest me.
    Sudhan

    Hi Sudhan,
    According to your description, you want to get Today date and LastYearSameDay date by using mdx query. In this case, you can use Now() function and DateAdd function to get the result. Here is a sample query for your reference.
    WITH MEMBER Measures.Today AS vba!Now(), FORMAT_STRING="Short Date"
    MEMBER Measures.Yesterday AS Dateadd("d",-1,Measures.Today), FORMAT_STRING="Short Date"
    SELECT {Measures.Today,Measures.Yesterday} on 0
    FROM
    [Adventure Works]
    Result:
    Regards,
    Charlie Liao
    TechNet Community Support

Maybe you are looking for

  • Free upgrade redemption for Retina Display MBP

    How do I redeem my free upgrade for my new retina mbp?

  • Itunes store app not working

    Anyone else having problems getting onto the itunes store. Not working at all on either of my ipads or phone, just a plain white screen and the spinning circle at the top? Noticing lots of little glitches lately, letting standards slip a little I thi

  • Problems changing location

    I have an account with the Apple Store online - [email protected] As far as the Apple store is concerned, I'm Amercan. They accept that my AmEx card is registered in New York, and allow me to buy goods there, delivering them to my NY office. This is

  • Elements trial will not open

    I downloaded the Photoshop Elements trial version to test before I purchased. It appears on my computer, but it will not open. Help please! I am afraid to go buy the real version if I cannot get the test to work!

  • Microsoft Office upgrade?

    I am still using Microsoft Office 2008 but cannot read various Excel files shared w/ PC users. What version should I use for my update? Can I get it at an Apple store or do I need to order it (or download it)? I have only purchased software when I ha