SSAS Dynamic Security on Parent Child Hierachy - ssas

I'm using the following MDX Query to define the allowed member set in a dynamic security role over a parent child hierachy:
Generate(
NonEmpty (
[Business Unit].[Business Unit Key].[Business Unit Key].members,
(
[Measures].[AD Account Business Unit Count],
StrToMember("[AD Account].[AD Account Name].["+Username()+"]")
)
), {
LinkMember (
[Business Unit].[Business Unit Key].CurrentMember,
[Business Unit].[Business Units]
)
}
)
The MDX query returns as expected when I run it in SQL, and when I look at the 'Basic' tab in the role the correct attributes of the hierachy are selected automatically... all good.
However when I process and view this hierachy in the cube I can still see all of the attributes of the hierachy as if the dynamic security role isn't working at all.

Could you plea try to place the same code in default member, The dynamic security with the security level of both allowed and default members. Please let me know the solution

Turns out that the browser was just being buggy for some reason, if I process the cube and connect via Excel for example then everything works as expected

Related

MDX YTD calculated measure

I'm still new to MDX and I'm trying to get some basic functions to work in my SSAS cube. Can you guys point out what I'm doing wrong here? I've added a calculated measure to my cube with the following code:
CREATE MEMBER CURRENTCUBE.[Measures].[Amount YTD]
AS
AGGREGATE(
YTD([OrderDate].[Calendar].CurrentMember)
,[Measures].[Amount]),
VISIBLE = 1, ASSOCIATED_MEASURE_GROUP = 'MyMeasureGroup';
After that I'm trying to get some data going...
SELECT
NON EMPTY
{
[Measures].[Amount]
, [Measures].[Amount YTD]
} ON COLUMNS,
NON EMPTY
{
[OrderDate].[Month].ALLMEMBERS *
[Product].[Product Group].ALLMEMBERS
} ON ROWS
FROM (SELECT ([OrderDate].[Year].&[2014-01-01T00:00:00]:
[OrderDate].[Year].&[2015-01-01T00:00:00]) ON COLUMNS
FROM [SalesOrderIntake])
This is the output I'm getting:
I'm not seeing any errors in my Output messages, which makes it difficult for me to figure out what is acting up. Hoping you guys can help me out on this one.
FYI: the actual select is just for testing purposes. I just want to get that YTD running. I've tried several things and it always comes out empty, so I was hoping to get some actual errors if I would query it directly in SSMS instead of using a BI tool. Also, the OrderDate dimension is a generated Time dimension which was provided to me by VS.
In your query you're using what looks like an attribute hierarchy:
[OrderDate].[Month].ALLMEMBERS
Whereas the measure uses the user hierarchy:
[OrderDate].[Calendar]
If you use Calendar in your script does it work ok?
#Error usually crops up when there are run time errors in MDX code. I could think of one scenario where the error might crop up. You are using [OrderDate].[Calendar].CurrentMember in the calculated member. But if instead of one, there are multiple members from this hierarchy in scope, it will throw an error.
The below is a scenario from Adventure Works.
with member abc as
sum(YTD([Date].[Calendar].currentmember), [Measures].[Internet Sales Amount])
select abc on 0
from [Adventure Works]
where {[Date].[Calendar].[Date].&[20060115], [Date].[Calendar].[Date].&[20060315]}
P.S. Thanks to #whytheq for teaching me this trick of checking this error by double clicking the cell :) Cheers.
I know, its an old post, but in the interest of posterity..
The correct approach is :
Aggregate
(
PeriodsToDate
(
[OrderDate].[Calendar].[Fiscal Year]
,[OrderDate].[Calendar].CurrentMember
)
,[Measures].[Amount]
)

icCube authorization on a parent child dimension - how to restrict access to upper levels?

This question uses the parent-child schema enclosed here.
I want to restrict access for a user on the 'dim (all)' hierarchy to view all the data at a certain level and below, but not the data above this member. For example, view 'Europe' and below this level, but I not the parent 'World'.
I managed to make a role that gives access to Europe and below, using the formula:
{[dim (ALL)].[Hierarchy].[ Level - 1].&[3].descendants}
and default member:
[dim (ALL)].[Hierarchy].[ Level - 1].&[3]
and apply to celss = Yes
But using this role, I still can see the World:
select [Measures].[value] on 0
, [dim (ALL)].[Hierarchy].allmembers on 1
from [cube]
result:
What do I need to do to 'redefine' the 'root' to 'Europe', if it is possible at all?
Sorry, it's currently not possible with security to convert a sub-tree into a tree. When allowing a member you do it for all ancestors.
In your example, if you allow [Europe] you allow [World]

Dynamic bucketing in ActivePivot

In our ActivePivot project, we have designed our cube with predefined hierarchies and levels. Among them, we have our currencies which all belongs to the same level.
Underlyings
|_ALL
|_UnderlyerCurrency
Our users would like to group those currencies, each group being possibly different based on user choice.
I know it is already possible to bucket/group members in ActivePivot using Analysis Dimension, but this is too static for our use case.
Is it possible to group those currencies per user ? is it possible to configure it without restarting the server ?
PS: we use Excel and ActivePivot Live as UI
Using MDX, it is possible to define bucket or group.
Here is a sample MDX that creates dynamically two buckets Europe and Asia in your existing hierarchy (I assume dimension and hierarchy have the same name) :
WITH
Member [Underlyings].[Underlyings].[ALL].[Europe] AS Aggregate(
{
[Underlyings].[Underlyings].[ALL].[AllMember].[EUR],
[Underlyings].[Underlyings].[ALL].[AllMember].[GBP],
[Underlyings].[Underlyings].[ALL].[AllMember].[CHF]
}
)
Member [Underlyings].[Underlyings].[ALL].[Europe].[EUR] AS Aggregate(
{
[Underlyings].[Underlyings].[ALL].[AllMember].[EUR]
}
)
Member [Underlyings].[Underlyings].[ALL].[Europe].[GBP] AS Aggregate(
{
[Underlyings].[Underlyings].[ALL].[AllMember].[GBP]
}
)
Member [Underlyings].[Underlyings].[ALL].[Europe].[CHF] AS Aggregate(
{
[Underlyings].[Underlyings].[ALL].[AllMember].[CHF]
}
)
Member [Underlyings].[Underlyings].[ALL].[Asia] AS Aggregate(
{
[Underlyings].[Underlyings].[ALL].[AllMember].[JPY]
}
)
Member [Underlyings].[Underlyings].[ALL].[Asia].[JPY] AS Aggregate(
{
[Underlyings].[Underlyings].[ALL].[AllMember].[JPY]
}
)
SELECT NON EMPTY {
[Underlyings].[Underlyings].[ALL].[Europe],
[Underlyings].[Underlyings].[ALL].[Europe].[EUR],
[Underlyings].[Underlyings].[ALL].[Europe].[GBP],
[Underlyings].[Underlyings].[ALL].[Europe].[CHF],
[Underlyings].[Underlyings].[ALL].[Asia],
[Underlyings].[Underlyings].[ALL].[Asia].[JPY]
} ON ROWS
FROM [YourCube]
With ActivePivot Live, user can write their own MDX (you can't do it with Excel though).
Then the interface will be smart enough to give the user all regular controls (wizard manipulations, drill down, sort, filtering, ...) on this table. On top of that, they will be able to navigate in it as if it was a regular hierarchy !
If you don't want users to write their own MDX, you have two solutions :
have someone with enough MDX knowledge that will write those queries, save it in a bookmark that will be shared with non technical users
extend the interface to create your own UI that generate those buckets: non technical users will be autonomous

Dimension hierarchy not showing all data

I have a users dimension, which represents the hierarchy of many shops. For instance, shops are split into Country - > Region -> Town/Village - > Actual Shop. So when you look at it from a hierarchy perspective, it is Level1, Level2, Level3, Level4 etc.
Now the strange thing is, if I execute the MDX query and filtering in the WHERE clause, by the hierarchy, for a specific user no data displays. However, if I execute the same exact MDX not filtering by the hierarchy, but filtering by the attributes, records are shown.
It is important to mention that the user hierarchy [UserIdHierarchy] contains a hierarchy of the following members
[UserLevel1Id]
[UserLevel2Id]
[UserLevel3Id]
[UserLevel4Id]
[UserLevel5Id]
These are the 2 cases, which should return exactly the same results...
Where clause filtering with user hierarchy :
where
(
DESCENDANTS([Dim User].[UserIdHierarchy].&[#12345],0, self)
)
Where clause filtering without user hierarchy :
where
(
DESCENDANTS([Dim User].[UserLevel3Id].&[#12345],0, self)
)
Why don't both of the filters, bring up the same data for this particular user?
The reason was that the User hierarchy was using historical approach. Therefore, when a user had more then one hierarchy (as shown below), for some strange reason the MDX got messed up and stood with the first item in the dimension hierarchy. Below, I am showing 3 different setups of a user, after his registration into the system. To fix my problem, instead of just doing
[Dim User].[UserIdHierarchy].&[#12345]
I'm filtering in the where clause all user members, i.e.
{[Dim User].[UserIdHierarchy].[UserLevel1Id].&[#12345],
[Dim User].[UserIdHierarchy].[UserLevel2Id].&[#12345],
[Dim User].[UserIdHierarchy].[UserLevel3Id].&[#12345]}
Then the actual filtering is done on the FACT data. This way I include all data for all members in the user hierarchy which match my user - which in this case was #12345.

How to retain expand/collapse with custom MDX in PerformancePoint

When creating a dashboard in PerformancePoint Services (PPS), I often resort to custom MDX in a number of areas:
Custom Filters
Custom Scorecard Axes
However, in both cases, PPS immediately drops the expand/collapse capability (tree view). I've explored the MDX issued by PPS using SQL Profiler and have attempted to mimic it to no avail.
For example, the following MDX in an MDX filter creates a Year/Month hierarchy without the intermediate semesters and quarters:
SELECT GENERATE(
[Date].[Calendar].[Month].Members
, {
Ancestors([Date].[Calendar].CurrentMember, [Date].[Calendar].[Calendar Year])
, Ancestors([Date].[Calendar].CurrentMember, [Date].[Calendar].[Month])
}
)
DIMENSION PROPERTIES MEMBER_TYPE ON 0
FROM [Adventure Works]
This results in a list of years and month, sorted correctly. But no tree view capabilities remain, despite selecting "Tree View" as the filter view type.
So, how do you feed PPS an MDX result set and end up with a working tree view?
I think instead of using Ancestors just use Descendants.
I usually use this structure in my PPS filters and it gives you tree view:
NonEmpty(
Order(
Descendants(
[Date].[Fiscal Calendar].[All].Children,
[Date].[Fiscal Calendar].[Month],
SELF_AND_BEFORE),
[Date].[Fiscal Calendar].CurrentMember.Member_Key,
DESC)
)
The result is years \ months with data. Descendants is pretty useful. And in a PPS filter expression CurrentMember is out of context. You have no CurrentMember at that point.
Let me know if it's helped or not what you're after.