Applying Security to Calculated Measures

Who is online?  0 guests and 1 members
Home  »  Articles  »  Applying Security to Calculated Measures

Applying Security to Calculated Measures

change text size: A A A
Published: 2/21/2010 by  AdamJorgensen  - Views:  [1592]  

 

    Tired of not being able to secure your Calculate Measures through SSAS? 

    One of the biggest issues facing Analysis Services Developers these days is applying security to calculated measures through roles. The problem is with the default behavior exhibited by Analysis Services. Currently if you follow the following steps, you cannot apply security to a calculated measure through a typical role setup.

    Typical Calculated Measure Creation

    Step 1 – Create a new calculated Measure for Profit

    clip_image001

    This measure does not need any special settings, nor would those help our issue.

    Step 2 – Deploy the Cube and Verify the Calculation is working

    clip_image002

    The calculated measure is calculating correctly, (Simple calc so we didn’t expect a problem).

    Step 3 – Create a new Role and try to add security to this measure

    clip_image003

    This won’t work no matter how many times we try it. Calculated Measures cannot be secured by typical security as SSAS is designed today. There is a workaround however that we can implement.

    It’s best to implement this before you begin creating your calculated members, since this will change the way they are all created. I am now going to walk you through the process of creating a calculated measure that will get around this limitation. The way we are going to do that is relatively simple, but must be followed step by step.

    Step 1 – Create a new Measure either as a named calculation in the DSV or in the relational source and add it to the DSV. We will set it with a default value of 0.

    clip_image004

    Step 2 – We will now add this to the cube as a new measure.

    clip_image005

    Once it is added, we need to go configure the actual calculation. Now where will we do this at? We are going to use a SCOPE statement and control the context of the measure to set it equal to the calculation we desire. To do this, go to the calculations tab and create a new Script Statement.

    Step 3 – Create a new Script Statement on Calculations Tab

    clip_image006

    The SCOPE statement is very effective for controlling a large number of context related issues and is used for anything from security to modifying other calculations and their solve order. For this use, it’s main job is to overwrite the value of 0 we placed in our Named Calculation, and replace it with the actual calculated value.

    I know this seems like a long way around, but it is the most straightforward way to implement this security. WAIT we haven’t done the security yet. Go ahead and deploy the new cube with the SCOPE statement so we can work with it.

    Step 4- Create the Role again and see if you get profit in your list to secure.

    clip_image007

    Now it’s there! Great Job!

    You’re now ready to begin adding more measures in the same fashion. This will become a quick and easy process once you get the hang of it. Also you will be able to do a few other things with this statement.

  1. Apply conditional logic to your calculated measures (you could do this before, but it is just as easy in the script designer.
  2. Implement Context sensitive measure calculations (this is much simpler when you’re already in the SCOPE statement.
  3. Document your measure calculations more easily.

    I hope this article helps you work through adding more complex calculations to your cube and securing them in the same way you secure your more traditional measures.

    As always, please post questions to the BIDN.com Forums.

 

 
0
/5
Avg: 0/5: (0 votes)

Comments (1)

CurrentMember
CurrentMember said:
Great article Adam! This is a common problem and the solution is not at all intuitive from the BIDS UI. I referenced this article in the BIDN analysis-services forum. Thanks for sharing -- Luke
3/31/2010
 · 
 
by

Most Recent Articles