SSAS OLAP Cube: Row level security with Cube Roles - sql-server

I got a multidimensional OLAP-Cube that attracts my MS SQL Server Database. By now, there was no need for row level security.
Now, we would like to grant access to different sales representatives with Excel-Sheets that have a Live-conneciton to Analysis Services - so every salesman could evaluate the revenues in his sales territory.
This is my data example:
Product table
Customer table
I build a role to restrict the access for the first salesman by customizing the access to dimension data:
new role in my cube
Then I tested my new role and got the following result:
result of product table after restriction
result of customer table after restriction
The restricted role still can see the whole data of the product table and the total amount of the customer table, although the totals are disabled:
disabled totals in Cube
Does anyone one my mistake I did when setting up the new role?
The result, I would like to see after restriction should be this way:
desired result
I hope that someone can help me despite the small amount of information.
Thank you so much!

I believe you can achieve this if you tick "Enable Visual Totals" at the bottom of the popup:

Related

How to write a DAX formula on an RLS SSAS?

I have a data model that is like this:
Joins are done between tables on storenumber and storename.
I would like to give access to the stores staff but they only see the sales of their own store. I added their mail in the table Y2_Stores.
The sales data are in the table Y2_Sales.
In analysis services I added a role "Stores" in read, in Membership I added the email addresses of the stores, on the line filters I put that but I see in the microsoft documentation that it is necessary to make a formula with the functions LOOKUPVALUE() and USERNAME() but I do not know how to build this formula..
I tried this formula in Y2_Sales line:
=Y2_Sales[storenumber]=LOOKUPVALUE(Y2_Stores[storenumber],
Y2_Stores[email], USERNAME(),
Y2_Stores[storenumber],
Y2_Sales[detail_number])
I tried this too:
Y2_Stores[email] = USERPRINCIPALNAME()
Can you help me to write the correct DAX formula?
Thanks a lot
UPDATE :
I added the Y2_StoreEmployee table with storenumber | email and made a relation on storenumber in double direction to the Y2_Stores table :
Relationships:
I created a role with this formula:
There should be a table related to Store, eg StoreEmployee, with (StoreNumber,Email), configured for bidirectional cross filtering with Store. Then the RLS filter filter is on StoreEmployee and is just Email=USERPRINCIPALNAME().
So each user sees only their own rows in StoreEmployee, that creates a filter that propagates to Store, and then to the Sales, Inventory, and Images.

Allocating a price to a service in SQL Server hotel reservation

I have a customer table and services table in SQL Server 2012. A customer can avail services if he wants, laundry, housekeeping, food.
In Customer table I have kept services as a multivalued attribute. When I resolve it, I make an associative entity for services table where I put C_id*, Service and Price.
My question is what query to write a subquery at time of table generation in of customer to enter a particular price for a service availed? Basically how to handle this? I would later use these to create an invoice when total bill calculated.
Likewise, I have member types as well. If a member is lifetime then allow 20 percent discount and seasonal 10 percent.
How to handle it? Subqueries?
Code snippets would help.

Many-to-Many-to-Many Relationship in SQL Server Analysis Services; Second Many-to-Many Relationship Not Working

Preface
SQL Server 2008 R2 Standard Edition, Multidimensional Cube
In my data warehouse I have the following tables:
Dimensions
DimPartnership - Groupings of Partners DimPartner - Groupings of
Investors (can be in multiple partnerships) DimInvestor - Individual
investors that can make up multiple partners
Facts
FactInvestments - Records related to investment activity. Contains a foreign key "InvestorKey" that relates to the DimInvestor table.
Bridges
BrInvestorPartner - Bridge table to resolve Investors to Partners
BrPartnerPartnership - Bridge table to resolve Partners to Partnerships
Problem:
I need to create a Many-To-Many-To-Many relationship in SSAS. The first many-to-many dimension is working, the second one is not.
Current Solution:
I have made two bridge tables that link the Investor dimension to the partner dimension and then the partner dimension to the partnership dimension. The cube processes and, as expected, the partner many-to-many dimension works correctly. I am able to slice measures in the fact table by partner members. However, when I apply partnership as a part of the query, it has no effect on the Investments measure group. My Investments measures group is ignoring this dimension, it seems.
Question
Can anyone point out what I'm doing incorrectly? Is this even supported by Microsoft? I can't find anything in their documentation about this, but I would assume this would be supported. I appreciate any guidance toward figuring out what's wrong. Can this be solved with scoping or doing some sort of intersection on Partner Partnership Count?
Pictures
Some pics that might help you:
Faulty results
Values and names edited to protect client privacy - same value returned for all partnerships (the total of all investments)
DSV
Cube Structure
Dimension Usage
And of course once I posted my question, I figured out the problem.
My dimension usage for the Partnership Dimension should use both v Br Investor Partner bridge and the v Br Partner Partnership bridge with Many-To-Many relationships. Everything is now working as expected.
Compare this to the Dimension Usage Screenshot in my OP:

How to store conditions to database?

Is there anyway to store conditions in relational databases? The condition is something like target profiling (like Facebook ads).
For example, we Facebook need to save the conditions for users who are women in 18 - 40 years old and "living in New York, US or Tokyo, Japan
Thank you.
You can have a table to store groups, and the group criteria? For instance, a group can be named 25-30, and we would have 2 columns a AgeFrom, and AgeTo... You would then use dynamic SQL to execute a created query on a result set - and your customers would fall automatically in the categories which are pre-configured.

SSAS Roles - Creating a Role to restrict access to the cube, by country

I'm trying to create a role, to restrict access to a cube on Analysis services, so that a member of this role can only see records related to a specific country (from a dim_country dimension). So, for example, they'd only see the records where the dim_country name is 'England', and nothing at all for any other countries.
The issue I'm getting is that all records are being returned, regardless of what I'm putting in. This issue is the case when testing in BIDS (using Test Cube Security) and from Excel when I've added the Roles= into the cube connection definition.
I'd appreciate any suggestions.
The Role Definition I've made the following changes, and replicated it in AdventureWorks General -> Read Definition Checked
Cubes -> Access =Read
-> Local Cube / Drillthrough Access selected
Dimension Data
On the Customer Dimension, in Country
Allowed Member set = [Customer].[Country].&[France]
Denied Member Set = [Customer].[Customer].[All Customers]
Enabled Visual Totals = Ticked.
As I said, the issue is that I'm getting all values returned, rather than those filtered by the country
This was caused by a known issue with Roles on SSAS.
The Role security Inheritance on Dimension Data doesn't appear to inherit.
I fixed the issue by going into the Cube Dimension Data dropdown and adding the Allowed Member set in there also. This resolved the issue.

Resources