I am trying to write some MDX which will return a subset depending on who is logged in.
For Admin users it should just return all elements.
For Super Users it would also return all elements.
For Planning users it should only return the elements they created, i.e. added to the dimension.
The problem is if a Planner logs in and they have not created any added elements then the view throws an error and the subset is empty saying "Internal Error 500".
The MDX is as follows:
Code: Select all
STRTOSET(IIF([}ClientGroups].([}Groups].[Planning],STRTOMEMBER("[}Clients].[" + USERNAME + "]")) <> 'Planning',"TM1SubsetToSet([Employee].[Employee] , 'Added Employees' , 'public')", IIF( COUNT(TM1FILTERBYLEVEL(Descendants(STRTOMEMBER('[Employee].[UserAdded_' + STRTOMEMBER("[}Clients].[" + USERNAME + "]").PROPERTIES("ClientName") + ']')),0)) = 0, "{[Employee].[Please Select]}","{TM1FILTERBYLEVEL(Descendants(STRTOMEMBER('[Employee].[UA_' + STRTOMEMBER('[}Clients].[' + USERNAME + ']').PROPERTIES('ClientName') + ']')),0)}")))
The count part of the MDX was an attempt to avoid the error but it errors because it cannot find the element to do the count.
I also tried the following but this basically does the same as count,
Code: Select all
VAL(STRTOMEMBER('[Employee].[UserAdded_' + STRTOMEMBER("[}Clients].[" + USERNAME + "]").PROPERTIES("ClientName") + ']').PROPERTIES("member_weight")) > 0
Maren