row level security
11 TopicsDynamic RLS with multiple tables
Hi there. I have a reasonably complicated dynamic RLS which i am trying to resolve through dax. Attached is the schema. The premise is the Id in the user table is the USERRPINCIPALNAME The user has a a list of companies they are allowed access to in the USERALLOWED table These companies have a relevant ID called InstanceId-CRMId that gets passed into a site list and on to the report to limit the data. The issue i am haivng is i do not want to have to use bidirectional relationships There iaremany to many relationships Performance is poor I cannot seem to get the RLS to properly work and the sites table isnt filtering when I add ID = USERPRINCIALNAME() in the user table. Can someone suggest specifc dax for this use case please??? I have looked at some RADACAD posts on this example but can't work it out. Thanks in advance!!Solved2.5KViews0likes5CommentsRLS
Hi, Need your assistance. I currently have a RLS that restricts access for viewing employees information out of the base location. Typically the Leads can view details based on Team ID and base location. And now I have a new requirement where I want to share the details of an employee who is out of the location (team id) but share a common work ID. Example: an employee with X team ID and working on a different project out of his base location. So he has 2 work id's say it as A and B where represent the work ID of base location and B out side of base location. Because of my current RLS the Lead M is not ablebto view the details of B and X employee. I tried to create some intermediate tables which work id's and matching team codes. Here if I hard-coded the work ID the RLS is working but not sure how to make it dynamic. So that when a Lead login userprincipalname() should be checked against the Work ID and display the Offshore employees along with base location else the normal RLS will work as is. Can you please help me on this. Thanks, AkashSolved1.3KViews0likes3CommentsRow Level Security - Multiple Filter Criteria
I am trying to use RLS to filter some data according to a table which stores users territory information. The territory information is a table ("UserTerritories") consisting of both a Country and a Territory. Both of these fields can be wildcarded with a * to indicate they have access to either all countries or all territories within a country. Example "UserTerritories" information table shown here. This would indicate that the first user (User 100) has access to all of Germany plus the West and North territories in Spain. User 200 has access to the East and Paris territories in France. User 300 has access to all data. Username Country Territory 100 Germany * 100 Spain West 100 Spain North 200 France East 200 France Paris 300 * * Example "Account" data to be filtered using RLS: Account Country Territory A001 Germany West A002 Germany Berlin A003 Spain West A004 Spain North A005 Spain South A006 France North A007 France East A008 France West A009 France Paris I have been able to use SELECTCOLUMNS in my RLS rules (as shown below) to be able to filter either country or territory but this treats each of these fields individually rather than as a combination. What this means is that if a user's territory rules has a * for one of the territory fields then it would include all territories for any of the countries they have access to and not just the one specific country. var UserCountrySet = SELECTCOLUMNS( FILTER( 'UserTerritories', [Username] = USERPRINCIPALNAME() ), "Country", [Country] ) var UserTerritorySet = SELECTCOLUMNS( FILTER( 'UserTerritories', [Username] = USERPRINCIPALNAME() ), "Territory", [Territory] ) return ("*" IN UserCountrySet || [Country] IN UserCountrySet) && ("*" IN UserTerritorySet || [Territory] IN UserTerritorySet) Can anyone provide any guidance how I can filter the list of Accounts by seeing if it matches ANY of the row entries (i.e. the Country & Territory combination) in my "UserTerritories" table please? Any help greatly appreciated. Thanks!Solved5.4KViews0likes2CommentsRow level Security on multiple dimension alias table
Hello All, We have a current setup of DW tables one fact which is connected to multiple dimension table, for an example lets take Fact Sales which is connected to multiple Dim Agents tables like Dim-Agent(Who sold the product) , Dim-Agent(who billed the product), Dim-Agent(who serviced the product). which is connected to the fact table different columns like agent_sold, agent_billed, agent_servd. The issue happens when i try to setup row level security for the Agent table, so i tried putting the below code to all the agent table in the row filter under Roles. ='Dim - Agent_sold'[Agent NT Login]=MID(USERNAME(),FIND("\",USERNAME(),1)+1,LEN(USERNAME())-FIND("\",USERNAME(),1)+1) when it is applied to only one table it works fine, but when i started applying to all the agent table it is doing like a inner join and showing the result. Kindly let me know how to handle this situation. Let me know if you need further information ThanksSolved1.6KViews0likes4CommentsHierarchical Row Level Security with Recursive Lookup
Hello all, in my data model, I am using dynamic row level security in a recursive hierarchy. It checks if the user has access to the organization or any parent organization and, if yes, shows the data record. Unfortunately, I cannot go beyond five levels (formula length limit) but need seven. Is it possible to make loop, recursion or list reduction in the formula, so that it just checks the whole path, regardless of the number of levels? This is my DAX-Formula at the moment: OR(OR(OR(OR( PATHITEMREVERSE(RELATED(Organizations[Org Path]), 1, integer) in calculatetable(values('Authorizations'[ID]), 'Authorizations'[Email]=userprincipalname()), PATHITEMREVERSE(RELATED(Organizations[Org Path]), 2, integer) in calculatetable(values('Authorizations'[ID]), 'Authorizations'[Email]=userprincipalname())), PATHITEMREVERSE(RELATED(Organizations[Org Path]), 3, integer) in calculatetable(values('Authorizations'[ID]), 'Authorizations'[Email]=userprincipalname())), PATHITEMREVERSE(RELATED(Organizations[Org Path]), 4, integer) in calculatetable(values('Authorizations'[ID]), 'Authorizations'[Email]=userprincipalname())), PATHITEMREVERSE(RELATED(Organizations[Org Path]), 5, integer) in calculatetable(values('Authorizations'[ID]), 'Authorizations'[Email]=userprincipalname())) I imagine something like this (mixture of JavaScript and DAX): [calculatetable(values('Authorizations'[ID]), 'Authorizations'[Email]=userprincipalname())].reduce((found, nextId) -> OR(PATHCONTAINS("path", nextId), FALSE) Regards, Fabian444Views0likes0CommentsCrossfilter and row level security
Hello, I have the following model for a report: I've been asked to implement RLS and I'm having some trouble figuring out the correct method. In my original model table 1 does not exist and is not required. Table 1 is added for RLS amd contains a list of users email addresses, and the IDs which represent the rows I want the fact table, table 2, to filter to. One ID can be accessed my multiple users in table 1 which is why it is a many>many relationship. The RLS is setup to use Userprinciple name to filter table 1 and subsequently table 2. This element seems to work fine, as I can see when RLS is applied, table 2 does filter to the correct IDs the person in table 1 has access to. Due to table 2 being the fact table and on the many of the many>one side, it does not pass these filters through to the associated dimension tables. I have been reading into this as it is new to me, and thought I could use crossfilter within my measures to make the filters flow through to the dimension tables. As an example, for a measure that counts the rows in table 3 I thought I could try something like the below to count the total rows in table 3, but only for the rows which match those filtered in table 2: CountRowsTable3 = CALCULATE( COUNTROWS(Table3), CROSSFILTER('Table2'[ColumnA],Table3[ColumnA],Both) When I do this calc I still get the total number of rows in table 3 without the RLS applied. Grateful for any steers on the best way to do this, or if I am down totally the wrong track happy to be told so too! Thank you1.9KViews0likes3CommentsTable level Security not working as expected
Hi Team, I want to hide fact table , if user is not present in User Table. Please find example below User Alias [email protected] [email protected] Fact Sales DateId SalesAmount 20220101 100 Implementation: I have used tabular Editor and selected Fact Sales and Updated Object level Security to None Roles: I went to manage roles and created role with below dax code RoleName: HideFactSales IF(NOT ISEMPTY(FILTER(VALUES(User),User[User Alias] = USERPRINCIPALNAME())),FALSE(),TRUE()) Testing in local: Consider my alias as [email protected] I have selected role as HideFactSales but table is hidden for me. I expect the FactSales to show because I'm valid user Please let me if I'm missing anything. I have published report to PowerBI Service and added my alias to Security section but it shows same behaviour. Please assist Note: I have been assigned as contributor role to workspace. Thanks, AbhiramSolved571Views0likes1CommentRls
Please can anyone suggest how to implement dynamic RLS in Powerbi service so that external user can see only their data. I am trying to set up role wherein it checks the login email is same as USERPRINCIPALNAME. The user table stores the email id as [email protected]. The MS Active directory has the user set up as abcd_fakeorg.com#ext#@trytowork.onmicrosoft.com What DAX can I apply and where and how1.3KViews0likes3CommentsDisplay only certain columns for each role
Hi, I have an Excel file with several columns in which there are data, budget and Invoice amount of every warehouse of the company. I've created a row level security role for each warehouse on my powerBI file and imported the Excel. I would like to display only relative data for each role while hiding other columns. I tried to fix it on Tabular editor but I didn't find anything related to columns, only tables. Here's the link at the Excel file: https://drive.google.com/file/d/1wF81egZtQwejqL57Vig0ehYgcxpFTU8X/view?usp=sharing1.4KViews0likes1CommentRow Level Security || Developer vs User view || Wrong Calculation || Measures not working
Hi all, I am a developer of a report and i have given access to many users by using Row Level Security. As a developer when i apply certain set of filters, i am getting the correct data i.e. measures are working properly. Cumulative exit and other measures are showing correct data, but when i apply the same filters for a test role(RLS) the measures are throwing different numbers. Developer view Test as a role ( Wrong Numbers, while same set of filters are applied)687Views0likes1Comment