Aggregate an attribute hierarchy in SSAS Tabular Model - mdx

I have created a tabular model using SSAS 2012 and i'm having an attribute hierarchy called "Date" (yyyy-MM-01T00:00:00 format) with 12000 records in it. I found a built-in function "Aggregate" to aggregate the user-defined hierarchies in Multidimensional model. Now, my question is how to aggregate my "Date" hierarchy per year with MDX?

Related

How the aggregation and calculated members work as combined to produce output in SSAS Cube

I am creating a POC on the SSAS. Ultimate goal is to be able to perform any kind of the calculation either ad hoc calculation or pre calculated with good performance. Existing solutions is based on the SQL server but due to the performance issues with huge data facing issues.
I need some insight upon how the Cube works to give faster outputs. I have created date dimensions with hierarchy Year-> Semester-> Quarter -> Month -> Week -> Date. Several other dimensions are linked with the date dimension. My cube has almost 10 to 15 dimension which have several role playing dimensions.There are almost two to three dates in every fact table.
How the Cube aggregates the data based on the dimensions linked to the facts?
Does it internally creates all the combination of the dimension values and saves the fact aggregate data internally?
Here i have attached an MDX script which hase YTD,MTD,QTD Calculated Measures.[Measures].[Value] measure has to be added based on the function applied on the date dimension. Does SSAS internally sum up the [Measures].[Value] for various hierarchy of the date/Other dimension/s? What exactly SSAS does to provide the final value fast?
Our system has large number of the fields whose calculation depends on the value selected by the end user to the number has to be calculated at run time by aggregating some other measures. Does SSAS is fast to provide the Calcualted Member output by using the internally aggregated values generated during the cube processing?
With Member [Measures].[YTDValue] as ([Measures].[Value],
OpeningPeriod([Rundate].[Calendar].[Date],[Rundate].[Calendar].CurrentMember.Parent.Parent.Parent.Parent.Parent))
Member [Measures].[QTDValue]
as ([Measures].[Value],OpeningPeriod([Rundate].[Calendar].[Date],[Rundate].[Calendar].CurrentMember.Parent.Parent.Parent))
Member [Measures].[MTDValue]
as ([Measures].[Value],OpeningPeriod([Rundate].[Calendar].[Date],[Rundate].[Calendar].CurrentMember.Parent.Parent))
SELECT
{
[Measures].[YTDValue],
[Measures].[QTDValue],
[Measures].[MTDValue],
} on 0,
{
[Rundate].[Calendar].[Date].Members
} ON 1
FROM
(
select
{
[Rundate].[Calendar].[Date].&[2015-01-09T00:00:00]
} on 0
from [Cube_Sample]
)

SSAS Multidimensional Dynamic Dimension Security MDX

I tried to implement Dynamic Dimension Security in SSAS 2012 Multidimensional Model. I have a little knowledge on this for I have already implemented row level security in SSAS Tabular using DAX.
What I did in Tabular is exactly the same as described in MSDN.
http://msdn.microsoft.com/en-in/library/hh479759.aspx
The DAX I used in tabular is:
**='Organization'[Project Id]=LOOKUPVALUE('Employee Security'[Project Id], 'Employee Security'[Login Id], USERNAME(), 'Employee Security'[Project Id], 'Organization'[Project Id])**
Organization - Dimension Table on which Dynamic filtering should be
happened (on the basis of Project Id).
Employee Security - Dimension Table with Login Id of users are stored
I need to implement the same functioning dynamic security in Multidimensional model too.
Can somebody help me with the MDX and steps that should be used here to achieve the same?
If you want any more clarifications on my requirement please do ask the same.
Thank You in Advance.
In multidimensional model you need to have a dimension which contains all user ids (which are joined to the project ids).
Then create a role and use StrToMember function to dynamically catch the users id and convert that into a member from the security dimension.
{StrToMember("Dim.Users.&[" + UserName() + "]")}
More about this topic can be read here: http://richardlees.blogspot.se/2010/10/ssas-dynamic-security.html

DAX equivalent for MDX Calculated Member

We have a SSAS 2012 tabular model at our disposal which we are reporting on with Tableau.
Currently, we have a dimension [Material] with an attribute [Department].
What we're trying to do is create an MDX calculated member equivalent in DAX for implementing a custom grouping of the [Department] attribute.
For instance:
CREATE MEMBER [Material].[Department].[AB] AS
AGGREGATE({[Material].[Department].&[A], [Material].[Department].&[B]})
We tried to add a calculated member [AB] in hierarchy [Material].[Department] in Tableau with this MDX expression:
AGGREGATE({[Material].[Department].&[A], [Material].[Department].&[B]})
At design time, the expression validates but when we try using that member in our report we get an error stating that this kind of MDX calculated members are not supported in DAX.
Does anyone know of an equivalent or if and how we should get this MDX member to work?
Use SUMX.
I would imagine your DAX measure would look similar to:
=SUMX(FILTER('Material', 'Material'[Department]=OR("A","B")),[MaterialQuantity])
A Tabular model does not support the creation of calculated members in the model. The best you can do is to use a query-scoped calculated member by defining it in the MDX query.
E.g.
WITH MEMBER [Material].[Department].[All].[AB] AS
AGGREGATE({[Material].[Department].&[A], [Material].Department].&[B]})
SELECT ...
FROM ...

SSAS All member questions

Let's say we have a Product dimension with three attributes:
ProductID (Key)
Color
Category
It seems each attribute has an All member.
Each All member is independent? I mean it is technically posible for the All member of Color attribute to have a diferent value than the All member of the Category attribute?
Is is possible to talk about the tuple (All "color", Winter category)?
The product dimension by itself has an All member?
I mean when talking about (2012 Year, Jan Month) when Year and Month belong to the Date dimension (diferent of Product dimension) I should think as if it was refering to:
(2012 Year, Jan Month, ProductID attribute All Member, Color attribute All member, Category attribute All member)
or
(2012 Year, Jan Month, Product dimension All Member)
?
EDIT: Maybe I should rewrite the question... I'm not sure at all how many "all member"'s exist in a given cube and how can I refer to each one of them.
I'm reading a book about SSAS 2008 R2. After some more Reading I think I should update the question, for instance when I'm refering to attributes I should say attribute hierarchies (no user defined).
Instead of answering my question, I would recommend anyone that feels lost trying to understand what the hell is a tuple, or cube spaces, mdx expressions, to read the book "Microsoft SQL Server 2008 MDX Step by Step"

Access system tables in calculation

Is there a way to access system tables in a SSAS cube calcuation?
For example the following query can be executed on a SSAS cube to return a last processed date:
SELECT LAST_DATA_UPDATE FROM $System.MDSCHEMA_CUBES WHERE CUBE_NAME = 'Cube'
How would one access this information in a calculation?
Background: We were using ASSP before (a third party sproc) to get the last cube processed date. Recently, this sproc threw an exception on one of our cubes and caused SSAS to go down. Using the above line of MDX did not have this behavior. I would rather not have our cube depend on third party code so I am looking for a way to access LAST_DATA_UPDATE in a calc for a specific cube name.
I usually include a detached Dimension in my cubes e.g. ".Cube Information" which includes attributes like this. Other useful attributes could expose the currency of the data e.g. when did the last underlying ETL process complete, or the release/build of your cube.
I feed this "Cube Information" dimension from a SQL view which returns a single row with whatever data is needed - you could use your SELECT statement. It also needs to return a Key column with a fixed value e.g. 1.
By "detached" I mean the "Cube Information" dimension has no entries in the Cube Dimension Relationship tab.
In the cube Calculation script, I assign the DEFAULT_MEMBER property for that dimension to the fixed Key value from the SSAS view.
Any client tool can then access those Dimension attributes.