After setting a cube I was asked to add dynamic security with use of table of users and data they can see.
The problem is that i have to take into account 3 different dimensions. I've decided to use the fact table with noneEmpty function on count.
NonEmpty([Dimension].[Hierarchy].members,
([Measures].[Allowed Count],
[Users].[User].&[UserName]
)
)
After setting role I've got result like:
Dim1 | Dim2 | Dim3
1 | A | 300
1 | A | 320
1 | A | 340
1 | B | 300
1 | B | 320
1 | B | 340
Where it should be:
Dim1 | Dim2 | Dim3
1 | A | 300
1 | A | 320
1 | B | 340
Data for allowed user access are stored in table like
UserName | Dim1Key | Dim2Key | Dim3Key
Hierarchy is like Each Dim1 contains each type of Dim2 that contains each type of Dim3.
And user can only access given member of Dim3 in Dim2 in Dim1.
Is there a way to connect this dimensions in MDX so each Dim in the end has only its respective values
UPDATE:
After some research I've got this query:
SELECT [Measures].[CC Count] ON 0,
NonEmpty(
(
NonEmpty((Dim1.children),
([Measures].[CC Count],
[Users].[User].&[userName]
))
,
NonEmpty((Dim2.children),
([Measures].[CC Count],
[Users].[User].&[userName]
)),
NonEmpty((Dim3.children),
([Measures].[CC Count],
[Users].[User].&[userName]
))
)
,([Measures].[CC Count],
[Users].[User].&[userName]
))
ON 1
FROM [Cost Center]
That gives me wanted results, but I can't place it into Dimensiom Data in Role. Is there a way to change it?