Dynamic Hierarchy in SSAS cube in MDX

Hello Every 1,
My Greetings for the day!!!
I am Hiren Parikh from India, working for a French Organisation.
I am developing a cube which has a different requirement related to Date Hierarchy.
They have asked us to create a dynamic date hierarchy like last 5 years from current year, last 5 quarters from current quarters, Last Year, Last Quarter etc. This means the values in this hierarchy will automatically get changed on regular basis.
For eg :- Last 5 years will include (members 2014,2013,2012,2011,2010) the same will get change in 2015 to (2015,2014,2013,2012,2011) 
Can you please suggest, How can I achieve ?
Thanks in Advance,
Regards,
Hiren Parikh

Hi Hiren,
According to your description, you need to create a hierarchy that the members should change along with date automatically, right?
In this case, you can limit the dimension members on the data source view by adding where clause.
where datediff(year,'2011-08-12',getdate())<=5
In this case, the year member on the date dimension always only contain last 5 years.
Reference
http://msdn.microsoft.com/en-us/library/ms174859.aspx
If this is not what you want, please elaborate your requirement, so that we can make further analysis.
Regards,
Charlie Liao
TechNet Community Support

Similar Messages

  • Connecting to an external SSAS cube in SSDT 2012 on Windows Server 2008 R2 Core

    Good Evening,
    We are experiencing issues when executing an SSIS package from a SQL Server job. However, when we execute the package locally, it is
    successful. The package connects to an external SSAS cube using MDX. I have attached the error message below. The connection manager is OLE DB Provider for Analysis Services 11.0. We can successfully ping the external site where the cube is located from the
    server with the job.
    We are using Windows Server 2008 R2 Core. We are trying to access an external cube through HTTPS by sending a username/password in the connection string. This is sent through an OLE DB connection in SSIS. I found an article which says that "Because
    there is no Web browser, you cannot activate a Server Core installation or access the Internet through a firewall that requires users to log on." Does anyone have any additional details on this...is this a futile effort?
    Thanks - Brett

    Hi Brett,
    According to your description, you are experiencing the error when you connect to SQL Server Analysis Services database on a SSIS package, right?
    In your scenario, you said that the package can be executed successfully on your local environment, the issue only occurs on the SSAS server. So please ensure that the provider was installed on the server. Besides, here is a blog which describe how
    to configure the Analysis Services Processing Task in SQL Server 2012 Integration Services, please refer to the link below to see the details.
    http://www.mssqltips.com/sqlservertip/2994/configuring-the-analysis-services-processing-task-in-sql-server-2012-integration-services/
    Regards,
    Charlie Liao
    TechNet Community Support

  • SSAS Cube Hierarchy Default Member, not aggregatable in pivot table multi select, Urgent

    Hi All,
    I have one problem in my project ssas cube. one of the dimension hierarchy, a value has been set up as default member in calculation tab.
    The problem is:
    When i filter (select multiple) this defaulted value and other value in excel pivot, it is always showing default member value instead of selected members aggregated value. if i remove default member it is working fine. Can you please provide work around
    for this.
    Please note that, if select multiple values within that hierarchy (this time not selected default value), aggregation is working fine.
    Thanks, Rajendra

    Hi Hirmando,
    According to your description, the default member cause incorrect data when dragging a attribute that contain a default member to the FILTERS area, right?
    I can reproduce this issue on my environment, when dropping this dimension in the filter area of my pivot table and select multiple members including the default member then only data for the default member is shown. Currently, it's hard to say the root
    reason that cause this issue. In order to narrow down this issue, please apply the latest server pack and cumulative update.
    Besides, you can submit a feedback at
    http://connect.microsoft.com/SQLServer/Feedback So that microsoft will confirm if this is a know issue.
    Regards,
    Charlie Liao
    If you have any feedback on our support, please click
    here.
    Charlie Liao
    TechNet Community Support

  • Service Not Available error with SSAS cube

    Hi,
    We imported Microsoft Analysis Services (SSAS) Cube into RPD using XMLA.  While using the drill down feature in BI answers using presentation hierarchies, OBIEE is generating the following error
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: URL: http://<server>/<app name>/msmdpump.dll. The http return status is 503.< html><head><title>Service Not Available</title></head><body>Service Not Available</body></html>
    However, drill down feature is working fine with attribute columns. Also the report is working fine up to certain level of drill down. In the log it is evident that OBIEE is generating multiple physical queries (with clause) to pull the data from the cube.
    Is there any limit on the size of the mdx or number of mdx queries that msmdpump.dll can process?  Is there any configuration that needs to be modified while working with SSAS cubes?
    OBIEE version: 11.1.1.6.2 BP1
    Much appreciate your time.

    Hi Dhar,
    Thanks for your reply.
    Yes, your observation is correct. Changing the type of the hierarchies has some effect on the issue. I'm able to drill down to few more levels as the MDX generated by OBIEE in this less complex. But ultimately I'm facing the same issue after certain stage. I can only think of, the number of physical queries generated by OBIEE, as one of the possible reason for this. What is your opinion?
    Interestingly, I tested the same RPD in 11.1.1.6.5 and I'm unable to reproduce in the issue so far in my testing . Is it a bug in 11.1.1.6.2?! However, upgrading to 11.1.1.6.5 is not an option for us at this stage.
    Were you able to resolve the issue completely by only changing the hierarchy type? What version you have used in you project?
    Thanks.

  • SSRS Date parameter - current month from SSAS cube

    I have a SSAS cube with a date dimension called Posting Period and now I would like to have my report parameter using this date dimension to show the current month.
    So far I have worked out the following expression which are working(Fiscal year calendar going from May to May) for the year component - but I can't figure out how to get it to work on Quarter date part (and the month) so as you can see
    the Quarter and month is hardcoded in the below expression:
    ="[PostingPeriod].[Posting Period].[Year].&[" + CStr(Year(Today())-1) + "].&[Q4].&[10]”
    Any help would be appriciated.
    Tx

    Hi HCMJ,
    In your scenario, you use the expression
    ="[PostingPeriod].[Posting Period].[Year].&[" + CStr(Year(Today())-1) + "].&[Q4].&[10]”
    to set the default value of the parameter and then use it in the MDX query, right?
    If in this case, you can use the expression below
    ="[PostingPeriod].[Posting Period].[Year].&[2013].&[Q" & DatePart(DateInterval.Quarter,today()) & "].&[10]”
    to set the value on Quarter date part.
    And it returns:
    If I have anything misunderstood, please point it out and elaborate the meaning of "but I can't figure out how to get it to work on Quarter date part (and the month) so as you can see the Quarter and month is hardcoded
    ", so that we can make further analysis.
    Regards,
    Charlie Liao
    TechNet Community Support

  • SSRS Report date parameter values using SSAS Cube as datasource

    Hey Guys, 
    i m building an SSRS report using SSAS cube as the data source. The report contains shared data-sets which provide the required data. below is the set up.
    Sql server version : Sql server 2008R2
    Report builder 3.0 
    I have, Report A, powered by Dataset D, running on Cube C. The dataset has 3 parameters out of which one of them is a date parameter- P1. I have it set up such that on the report there is  another parameter - P2 which contains the type as Date ( to
    ensure the user is exposed to a date picker), the input from this, P2 is then manipulated to required format before fed into the dataset parameter P1 (hidden). I have two questions regarding this parameter.
    Currently, when the user pick's a date (P2) which has no values, the report errors out as it doesn't find that corresponding member on the cube. Can it be made such that if the member doesn't exists, a simple error message like "date not found"
    pops up as opposed to report failing?
    Secondly, can i manipulate the date picker (P2) exposed to the user such that the unavailable dates are grey'ed out on the date parameter (P2)? 
    Please let me know if there is any more info required on each of the questions.
    Thanks
    Srikanth

    Hello Katherine,
    below are the errors which pop up with the 'Constrained' function in place and without. The MDX query is what follows.
    Without: 
    An Error has occurred during report processing. (rsProcessingAborted). The Execution Failed for the shared data set “Dataset1”.(rsDataSetExecutionError). Query Execution failed for dataset ‘DataSet1’. (rsErrorExecutingCommand). The dimension ‘[10 Sep 2014]’
    was not found in the cube when the string, [10 Sep 2014], was parsed.
    With Constrained flag:
    An Error has occurred during report processing. (rsProcessingAborted). The Execution Failed for the shared data set “Dataset1”.(rsDataSetExecutionError). Query Execution failed for dataset ‘DataSet1’. (rsErrorExecutingCommand). Query(1,1476) The restrictions
    imposed by the CONSTRAINED flag in the STRTOSET function were violated.
    SELECT
    NON EMPTY
    [Measures].[A]
    ,[Measures].[B]
    ,[Measures].[C]
    ,[Measures].[D]
    ,[Measures].[E]
    } ON COLUMNS
    ,NON EMPTY
    [DimA].[LevelA].[LevelA].ALLMEMBERS*
    [DimB].[LevelB].[LevelB].ALLMEMBERS*
    [Date].[Date].[Date].ALLMEMBERS
    DIMENSION PROPERTIES
    MEMBER_CAPTION
    ,MEMBER_UNIQUE_NAME
    ON ROWS
    FROM
    SELECT
    StrToSet (@FilterA ,CONSTRAINED) ON COLUMNS
    FROM
    SELECT
    StrToSet(@Date, CONSTRAINED) ON COLUMNS
    FROM [Cube1]
    WHERE
    [DimC].[Level1].&[Member1]
    ,[DimC].[Level2].&[Member1]
    ,[DimC].[Level3].&[Member1]
    ,[DimC].[Level4].&[Member1]
    Thanks
    Srikanth

  • Adding WHERE condition in "Calculations" tab of SSAS Cube Designer

    HI,
    I am using SSAS 2012 version to develop SSAS cube
    and need help on following scenario :
    In the BIDS designer, on the Calculations tab: 
    I am creating one calculated member called [% Jobs] for which I am writing MDX expression as below :
    '([Measures].[On Time jobs]/[Measures].[Total Jobs])*100'
    Till here all is well... 
    Now, How do I implement here WHERE condition ? 
    For ex., in my fact table I have a column Line_Number
    I want to implement above MDX expression such that it only considers Line_Number=1
    while doing the above calculation.
    Hope it is clear. 
    Thanks...

    I tried with below method :
    While keeping the expression as it is :
    '([Measures].[On Time jobs]/[Measures].[Total Jobs])*100'
    What I did was in the partition tab, i choose option "Query binding" (instead of Table binding) and over there I mentioned the condition 
    WHERE Line_Number=1
    So it should do the calculations only for the first line.
    Is this approach also correct ?
    Thanks 

  • Using Pivot-Slicers on a SSAS Cube with Access Rights

    Dear all,
    we're using a SSAS Cube and try to access the data by an Excel Pivot. That works fine.
    Furthermore, we are using the slicer feature of Excel 2010 to select the specified data.
    The problem is that we have a dedicated rights concept and only some users are allowed to see all dimension elements. Other users are not allowed to see all the data. This is ok and works for Pivots, as we can see there only the elements which the respective
    user is allowed to see. In the case of slicers this doesn't work: the slicers always show all dimension elements (the restricted ones with 0-values). Can this somehow be repaired, so that the user only sees the elements in the slicer he's allowed to see?
    Best Regards
    Bjoern

    Hi Charlie,
    I guess we have some kind of language barrier here because i did not fully understand your explanation.
    I've got a User Günther who is only to allowed to see the revenues of his own company.
    Therefore, he has got a restriction on the company-dimension, which has 100 companies. He is only allowed on his own company.
    If we open a new pivot with the company dimension, he will only see 1 column (with his company) instead of 100.
    If I currently add a slicer to the pivot, the list of elements in the slicer contains 100 companies. All of them are also shaded (which shows, that data is available). If i click on a shaded company, on which he is not allowed, Günther only sees zero-values
    (0,00).
    In this case, it would be better to only see the 1 company the slicer shaded, which has values that Günther is allowed to see. Then, he would only see his own company shaded and 99 would have the look like being "without data". 
    If my proposal would be impleneted, it would be much easier to use excel BI services on a big SSAS cube with multiple dimensions and multiple users that have different access rights. 
    The best would be, if a slicer could be customized in more details (e.g., with a mdx query).
    // Do I perhaps have misplaced the question into the wrong forum?
    Best Regards
    Bjoern

  • Filtering Parent-Child Hierarchy in SSAS Dimension

    Hello,
    I have a parent child hierarchy in ssas dimension. Parents level can be vary. As an example, I have 4 levels and parent may exist in level 1, level 2 or level 3.
    What I need to do is filter those parents using one of the attributes in that dimension. I can't do it as normal, because once I apply a filter to parents, that will be affected to its children as well. 
    what normally happens
    Parent1(attribute=true) - > Child 1(attribute=true) -> Child 2 (attribute=true)
    Parent 2(attribute=true) -> Child 3 (attribute=true)
    what I need
    Parent1(attribute=true) - > Child 1 -> Child 2
    Parent 2(attribute=true) -> Child 3 
    How can I achieve this?

    Finally descendant function worked for me. I had to filter necessary properties first.
    WITH SET ParentCodes AS (
    Descendants(
    FILTER(
    [DimX].[Code].members,
    [DimX].[Code Parent].currentmember.Properties("Area") 
    = "Northern"),,
    SELF)
    SELECT
    {[Measures].[TotalAmount]} ON 0,
    {ParentCodes } ON 1
    FROM [Cube]
    Hope this helps

  • Insert SSAS Cube records measure and dimensions to relational table

    Hi,
    I need to retrieve one measure with a couple of its related dimensions from an ssas cube and have it stored in SQL table. How could this be done?
    In order to read data from cube and insert into SQL relational table
    this thread says to use openquery but states that it will only work if there are measures on the columns
    and no dimensions on columns.
    Is there a way to query a measure with a couple of its related dimensions
    in MDX using openquery? Or any other way to query the cube to get these into SQL?
    (Or should I better get the data from the base SQL tables which the cube is built from?)
    Thanks for advising
    Namnami

    Hi Namnami,
    Sure Darren Gosbell thread will help you, you can try below things.
    You can get more info on
    this link
    Basically to write SQL+MDX combined we have to create link server from where we want data to combine with SQL. To create link server you need to have Admin access to the SQL Server.
    IF IS_SRVROLEMEMBER ('sysadmin') = 1
    print 'Current user''s login is a member of the sysadmin role'
    ELSE IF IS_SRVROLEMEMBER ('sysadmin') = 0
    print 'Current user''s login is NOT a member of the sysadmin role'
    ELSE IF IS_SRVROLEMEMBER ('sysadmin') IS NULL
    print 'ERROR: The server role specified is not valid.'
    Above Query returns the whether you have admin admittance to the server or not to create Link Server.
    More Details on Hybrid Query-
    USE
    AdventureWorksDW2008R2
    GO
    EXEC
    sp_addlinkedserver
    @server='Test',
    @srvproduct='',
    @provider='MSOLAP',
    @datasrc='localhost',
    @catalog='Adventure Works DW 2008R2'
    Declare @MDXExpression as Varchar(MAX)
    Select @MDXExpression =
    SELECT
    NON EMPTY
    [Measures].[Sales Amount]
    ,[Measures].[Standard Product Cost]
    ,[Measures].[Tax Amount]
    ,[Measures].[Total Product Cost]
    } ON 0,
    NON EMPTY
    [Sales Channel].[Sales Channel].[Sales Channel]
    } ON 1
    FROM
    [Adventure Works]
    Exec ('SELECT * INTO ##TestTemp FROM OpenQuery(TestTest1,''' + @MDXExpression + ''')')
    SELECT
    CONVERT(varchar,t."[Sales Channel].[Sales Channel].[Sales Channel].[MEMBER_CAPTION]") AS [Date],
    (CONVERT(nvarchar,t."[Measures].[Sales Amount]")) AS [Sales Amount],
    (CONVERT(nvarchar,t."[Measures].[Standard Product Cost]")) AS [Standard Product Cost],
    (CONVERT(nvarchar,t."[Measures].[Tax Amount]")) AS [Tax Amount],
    (CONVERT(nvarchar,t."[Measures].[Total Product Cost]")) AS [Total Product Cost]
    from
    ##TestTemp t
    --DRop Table ##TestTemp
    Query Execution-
    1-     
    So above query first creates liked server with named as 'Test'.
    2-     
    After that MDX query executed on linked server where we have kept the MDX query in MDXExpression variable.
    3-     
    Using OpenQuery function data gets dump in to ##TestTemp table.
    4-     
    Finally we get the data from ##TestTemp table.
    Thanks,
    Mark as Answer if this resolves your problem or "Vote as Helpful" if you find it helpful.
    My Blog
    Follow @SuhasKudekar

  • Interacting with the ssas cube from a web application

    Hi All,
    I have a requirement in which we are using a web application to show the reports designed in ssrs. As of now we are hitting the Database and getting the reports. But now we have developed a cube and we want to display the reports from ssas Cube.
    My issue lies here.  How to populate the filter drop down lists from ssas Cube ( how to read the mdx format ).  Is there any way or work around to do it in ASP.Net..
    To be more clear the report output will be from ssrs dashboard. Filters should be populated from cube.
    Thanks in advance
    Regards
    Balaji - BI Developer

    Hello,
    You can use .NET AdoMd Client to connect to SSAS and to run MDX queries agains a cube; see
    ADOMD.NET Client Programming and
    Microsoft.AnalysisServices.AdomdClient Namespace
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • SSRS Expression Current month in a Fiscal calendar dimension from a SSAS cube

    How to create an expression for a default SSRS parameter to a SSAS cube when using i Fiscal Year calendar - and where I want to show current Calendar month and year (for example February 2014) 
    This is an example of my Time dimension for February 2014:
    [Time].[FiscalYMD].[Fiscal_Year].&[2013].&[10]
    The fiscal calendar goes from May - May - which means that April 2014
    would look like this:
    [Time].[FiscalYMD].[Fiscal_Year].&[2013].&[12]
    and May 2014 would look like this:
    [Time].[FiscalYMD].[Fiscal_Year].&[2014].&[01]
    Please advise

    Hi HCMJ,
    To represent the fiscal calendar, you shift the current date by 4 months back. Then you can do:
    ="[Time].[FiscalYMD].[Fiscal_Year].&[" & Year( DateAdd( "m", -4, Today() ) ) & "].&[" & Month( DateAdd( "m", -4, Today() ) ) & "]"
    It just gets the year and month of '4 months ago'. I have not tested it, but I guess it should work.
    Regards
    Andrew Borg Cardona

  • SSAS cubes - fragments

    Hi,
    Hoping someone can help. I have defined a logical model over the top of a set of SSAS cubes in a single SSAS database. This consists of a summary cube and detailed cubes that relate to individual products. I would like to have a "Product" dimension that will allow the user to drill between the products and for dimensions at lower levels of granularity (i.e. that are only relevant to one product) data should be sourced from the relevant detailed cubes. Unfortunately although the summary cube has a product dimension the detailed cubes don't - when I try to map the detailed cube to the product dimension using an expression I get the following error message: "Target data source does not support the Complex Expression operation."
    e.g.
    Product Dimension has 3 products in it: Bikes, Cars and Boats. There is a summary cube that contains all 3 products and has the Product dimension defined.
    There are 3 detailed cubes for Bikes, Cars and Boats that don't have a product dimension. In my mappings for the Product Name attribute of the Product dimension I have the following:
    Logical Table Source..... Mapped As
    SummaryCube..... Product.Product
    BikeCube... 'Bikes'
    CarCube... 'Cars'
    BoatCube.. 'Boats'
    Hope this explains it. I get the error message whenever I'm trying to get data from the detailed level cube.
    Thanks,
    Rob

    Hi Platt,
    By default, the default account for AS services 'NT Service\MSSQLServerOLAPService' has only public permission to few databases. If you haven't change the AS services account, or haven't grant the permission for this account, then you cannot deploy
    the AS project to server.
    So in your scenario, ensure the service "SQL Server Analysis Services" is running with a proper Log On As user. This user should have administrator permission on Analysis Services and the proper permissions on the database engine. To avoid this
    issue, you can grant the SELECT permission for the default account for AS services to data source DB. Or you can change the services account to this domain user who has the corresponding to the data source DB.
    http://jetreportskb.host4kb.com/article/AA-00238
    http://msdn.microsoft.com/en-in/library/ms175371.aspx
    Regards,
    Charlie Liao
    TechNet Community Support

  • Date parameter in report whose source is SSAS cube shows all dates in DimDate?

    My cube consists of a FactTable that has a foreign key to [DimDate], through column [DateKey]. My DateKey has dates from
    20010101 to 20201231. My fact table only has data from today (20141017). 
    In SSRS, I add the dimension Dim Date, Date Key as parameter. When I run the report, everything runs great, the only problem being that the date dropdown shows all the
    DateKeys from [DimDate] (20010101 to 20201231).
    How can I only show in the dropdown parameter only the DateKeys that have actual data? In this case, the parameter would only only display 20141017.
    Thanks.
    VM

    Thanks, but I don't think you read the whole question. 
    I'm using as datasource an SSAS cube. The query that populates the parameter looks like this:
    WITH MEMBER [Measures].[ParameterCaption] AS [Dim Date].[Date Key].CURRENTMEMBER.MEMBER_CAPTION MEMBER
    [Measures].[ParameterValue] AS [Dim Date].[Date Key].CURRENTMEMBER.UNIQUENAME MEMBER
    [Measures].[ParameterLevel] AS [Dim Date].[Date Key].CURRENTMEMBER.LEVEL.ORDINAL
    SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS ,
    [Dim Date].[Date Key].ALLMEMBERS ON ROWS FROM [Sales cube]
    VM

  • Using FORMAT_STRING from SSAS cube - not working consistently

    Here's the deal.  
    I've got an SSAS cube and I am scoping the format of the measures based on dimension members. 
    Like this.
    scope(( [Account].[Level 5].&[I000900000] )); 
    format_string(This) = "(#,0,);#,0,";   
    end scope; 
    I'm then calling this format in the SSRS report using typical SSRS trickery and hacks.  
    Well. When I run the report for one date (this is a GL financial cube), this works perfectly.  When I run the report for a different date, it all of a sudden doesn't work.  When I view the data in excel through a pivot table, everything is fine.
    It's driving me crazy.  Has anyone else experienced something like this.

    Hi Baracus,
    Thank you for your question. 
    I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated. 
    Thank you for your understanding and support.
    Regards,
    Charlie Liao
    TechNet Community Support

Maybe you are looking for

  • Accounting document not generating for Invoice cancellation

    Hi Gurus We have a scenario where two invoices are getting generated from one contract(Order related billing). But when cancelling these two invoice one cancellation document is not generating accounting document. The posting period is open on the da

  • Download of Oracle 8i Database Problem

    Everytime I download the database from the developer area, it appears to go great. However, neither Winzip or PKunzip can work the file. They always encounter errors that are not fixable. This happens 100% of the time. It is frustrating considering t

  • HT4623 i had a problem when i update iphone 3gs from ios 5.1.1 to 6.1. How could i fix it?

    i had a problem when i update iphone 3gs from ios 5.1.1 to 6.1. How could i fix it?. I can active my phone?help me, please!

  • Link to iTunes Store

    Hi all, Is there any way that I can turn off the small arrows which lead me to the iTunes Music Store? I actually forgot the name, but I can remember it was possible to turn them off in iTunes 7. I would want to know if I can also turn them off in iT

  • Display a Custom Sum that will Ignore Certain values

    In addition to the sum that I am computing on Current Total Column in SQL Plus, I also want to do a Custom Sum on Current Total Column that will ignore certain values of the Current Total column, but displays at the same frequency as the break group.