Database Reference
In-Depth Information
The result will be as follows:
The user is allowed to see
Sales Amount
for all resellers but not
Gross Profit,
, which
is only available for
Roadway Bicycle Supply
.
As we see, the expression is very complex and evaluating this for every cell in the
query can have a negative impact on query performance. If we want to optimize the
performance of cell security expressions, we can leverage the MDX script, which as
we know is evaluated before cell security.
In this case, we can define a new hidden calculated measure,
HideGrossProfit
,
to hold the logic for our cell security expression. In the initial calculated measure
definition we give it a default value of
False
; we then use
SCOPE
statements to
overwrite its value for the parts of the cube where it should return
True
.
CREATE MEMBER CurrentCube.Measures.HideGrossProfit AS
False,
Visible = 0;
SCOPE (Measures.HideGrossProfit);
SCOPE (StrToMember ("[Users].[User].[" + UserName() + "]"));
THIS = (Measures.[Bridge Reseller Users Count] = 0);
END SCOPE;
SCOPE (Reseller.Reseller.[All]);
THIS = True;
END SCOPE;
END SCOPE;
Search WWH ::
Custom Search