SSAS Multidimensional Dynamic Dimension Security MDX - ssas

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

Related

SSAS - No of Working Days as Named Calculation

I am new to SSAS. I have a requirement, I need to calculate no of working days between user selected date range (either in Excel or SSRS or PowerBI). I found the MDX query, I need assistance with create a named calculation with MDX expression.
Date Dimension (Filtered):
MDX:
WITH MEMBER Measures.WorkingDays AS
COUNT
(
exists( EXISTING {[Dim Date].[Date].[Date].members}
, [Dim Date].[Is Weekday].&[1] )
)
Select {Measures.WorkingDays} on 0 ,
[Dim Date].[Month].[Month] on 1
from [Project Cube]
where ([Dim Date].[Date].&[2018-01-01T00:00:00]:[Dim Date].[Date].&[2018-04-25T00:00:00])
I need to add this named column on Fact table as measurement. I am having trouble with the below items:
Creating named query with MDX expression mentioned.
Adding a [Number of Working Days] as measure in Fact table.
Please correct me, If I am doing it in wrong way. My requirement is I need a [NoOfWorkingDays] as measure in fact table, so that I can use SSAS aggregate to use it as input on other measure, such as ([utilization%] = ([ActualDaysWorked] / [NoofWorkingDays]).
Note that, I can do analysis with the given MDX, but I need to deploy it with precalculated values in cube, so that end user can directly use the cube.
Kindly let me know, if more details required, Thank you.
Welcome to SSAS and MDX. Now to the answer.
I need to add this named column on Fact table as measurement. I am
having trouble with the below items:
Creating named query with MDX expression mentioned. Adding a [Number
of Working Days] as measure in Fact table.
You dont need to add it to the Fact table at all. Open your SSAS project, in your object explorer double click your cube. Now on the top left hand you will see a CALCULATIONS tab. In the CALCULATION tab, Click new calculated member, the icon has a calculator on it.
Please correct me, If I am doing it in wrong way. My requirement is I
need a [NoOfWorkingDays] as measure in fact table, so that I can use
SSAS aggregate to use it as input on other measure, such as
([utilization%] = ([ActualDaysWorked] / [NoofWorkingDays]).
If I remember correctly, the calculated members will not be added into the Aggregations, however the underlying measures would be. Secondly if you are wondering that you can use your calculated Measure in another calculated measure. The answer is yes you can use it in another calculated measure. So this is totally possible
> ([utilization%] = ([ActualDaysWorked] / [NoofWorkingDays])
where [utilization%] and [NoofWorkingDays] are calculated measures.

referenced relationships sql server analysis Services, How can i create it

enter image description hereI'm beginner in SSAS, actually I work on SSAS Olap cube I have an issue which is I can not add customer fields to charge dimension or to charge fact (to be displayed on power bi )
Thank you in advance
The general answer is:
Add dimension to the cube
Open "Dimension Usage" tab
Click on a cell crossing Measure Group vs Dimension
Use "Referenced" type and select another dimension as a Reference
But please provide more details:
What have you tried before asking a question here?
Why it didn't help?
What are you trying to achieve (with simple example in Excel, plain text etc.)? Like Customer: A,B,C, Charge: X,Y,Z. Their relations. What is your expectation.

How can i Extract Dimention - Fact connection Data from cube?

is there away to extract cube connections between fact and Dimensions as they are defined in the dimension usage ?
in connection i mean the Dimension Table and key columns as well as Measure group name, Columns as they are defined in the dimention usage
i am aware of ssas DMV as well as analysis server Stored procedure project (codeplex) but couldn't find my answer there .
thank u
Will the BIDS Helper Printer Friendly Dimension Usage feature or Column Usage Reports feature accomplish what you want?
Were you just wanting a PDF for documentation? If you need the C# code so you can embed it in your own program let me know.

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

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.