<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Bypass RLS through DAX in Manage roles section in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bypass-RLS-through-DAX-in-Manage-roles-section/m-p/3426899#M129869</link>
    <description>&lt;P&gt;You can use an &lt;STRONG&gt;OR&lt;/STRONG&gt; condition in the DAX formula to check if the user is part of the "Admin" team. If they are, the RLS filter will not be applied.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;= 
(
    [user email] = USERPRINCIPALNAME() 
    || 
    LOOKUPVALUE('Admin_RolesAndPermissions'[Team], 'Admin_RolesAndPermissions'[user email], USERPRINCIPALNAME()) = "Admin"
)&lt;/LI-CODE&gt;&lt;P&gt;Just as a reminder to implement this, you would:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Go to the "Modeling" tab in Power BI Desktop.&lt;/LI&gt;&lt;LI&gt;Click on "Manage roles."&lt;/LI&gt;&lt;LI&gt;Create a new role or edit an existing one.&lt;/LI&gt;&lt;LI&gt;Paste the DAX filter expression next to the table where you want to apply RLS.&lt;/LI&gt;&lt;LI&gt;Save and close the "Manage roles" window.&lt;/LI&gt;&lt;LI&gt;Before publishing, you can view the report as roles to test the RLS.&lt;/LI&gt;&lt;/OL&gt;</description>
    <pubDate>Tue, 12 Sep 2023 17:33:28 GMT</pubDate>
    <dc:creator>MargusMartsepp</dc:creator>
    <dc:date>2023-09-12T17:33:28Z</dc:date>
    <item>
      <title>Bypass RLS through DAX in Manage roles section</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bypass-RLS-through-DAX-in-Manage-roles-section/m-p/3426606#M129834</link>
      <description>&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In our dashboard are currently using RLS (user email = userprincipalname()) to show data based on the logged in user. Now, we need to bypass this RLS when the user is from "Admin" team.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have pasted below the sample data:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;user id&lt;/TD&gt;&lt;TD&gt;user name&lt;/TD&gt;&lt;TD&gt;user email&lt;/TD&gt;&lt;TD&gt;Team&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;A@abc.com&lt;/TD&gt;&lt;TD&gt;Admin&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;B@abc.com&lt;/TD&gt;&lt;TD&gt;Employee&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;C@abc.com&lt;/TD&gt;&lt;TD&gt;Employee&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;D@abc.com&lt;/TD&gt;&lt;TD&gt;Employee&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;E&lt;/TD&gt;&lt;TD&gt;E@abc.com&lt;/TD&gt;&lt;TD&gt;Employee&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;F&lt;/TD&gt;&lt;TD&gt;F@abc.com&lt;/TD&gt;&lt;TD&gt;Admin&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For Example: when user A or F logs in then RLS should not be applied i.e. The user should be able to see all data. when the other users except A and F log in , they should see only their data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please can someone help in this regard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;AnthonyJoseph&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 14:48:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bypass-RLS-through-DAX-in-Manage-roles-section/m-p/3426606#M129834</guid>
      <dc:creator>AnthonyJoseph</dc:creator>
      <dc:date>2023-09-12T14:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: Bypass RLS through DAX in Manage roles section</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bypass-RLS-through-DAX-in-Manage-roles-section/m-p/3426805#M129849</link>
      <description>&lt;P&gt;It isn't bypassing RLS. You create a new roll that doesn't have the username filter on it. This would be great as an AD group.&lt;BR /&gt;&lt;BR /&gt;But if you really wanted to do it all in one, do something like an OR(&lt;SPAN&gt;user email = userprincipalname(). Team="Admin")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If this post was helpful, please kudos or accept the answer as a solution.&lt;BR /&gt;~ Anthony Genovese&lt;BR /&gt;Need more PBI help? PM me for affordable, dedicated training or consultant recomendations!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 16:35:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bypass-RLS-through-DAX-in-Manage-roles-section/m-p/3426805#M129849</guid>
      <dc:creator>AnthonyGenovese</dc:creator>
      <dc:date>2023-09-12T16:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: Bypass RLS through DAX in Manage roles section</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bypass-RLS-through-DAX-in-Manage-roles-section/m-p/3426883#M129863</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="422509" data-lia-user-login="AnthonyGenovese" class="lia-mention lia-mention-user"&gt;AnthonyGenovese&lt;/a&gt;&amp;nbsp; I tried the &lt;SPAN&gt;OR([&lt;/SPAN&gt;&lt;SPAN&gt;user email] = userprincipalname(), [Team]="Admin") but its not working as expected i.e. its reacting the same as&amp;nbsp;[user email] = userprincipalname().&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If I create another role, will this ignore the existing&amp;nbsp;[user email] = userprincipalname() RLS? not sure what I am missing...&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 17:16:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bypass-RLS-through-DAX-in-Manage-roles-section/m-p/3426883#M129863</guid>
      <dc:creator>AnthonyJoseph</dc:creator>
      <dc:date>2023-09-12T17:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Bypass RLS through DAX in Manage roles section</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bypass-RLS-through-DAX-in-Manage-roles-section/m-p/3426890#M129867</link>
      <description>&lt;P&gt;&amp;nbsp;Yah sorry. Its not exactly team="admin" I think you would have to write dax that looks at the userprincipal name, does a lookup to see if they are an admin, and if so, then returns true on the second part of that OR statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Personally, I would go the route of a different role. That is what it is there for. It is what we implement in our many RLS instances.&amp;nbsp; The greatest thing about RLS is that security is additive. So if you have one restricted like you have, and then another role where someone gets full access, then the user does get full access.&amp;nbsp; Basically, if you have multiple roles, and a user is in multiple roles, as long as they have access in one of those roles, then they have access.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this post was helpful, please kudos or accept the answer as a solution.&lt;BR /&gt;~ Anthony Genovese&lt;BR /&gt;Need more PBI help? PM me for affordable, dedicated training or consultant recomendations!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 17:23:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bypass-RLS-through-DAX-in-Manage-roles-section/m-p/3426890#M129867</guid>
      <dc:creator>AnthonyGenovese</dc:creator>
      <dc:date>2023-09-12T17:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: Bypass RLS through DAX in Manage roles section</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bypass-RLS-through-DAX-in-Manage-roles-section/m-p/3426896#M129868</link>
      <description>&lt;P&gt;Thank you for sharing your thoughts&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="422509" data-lia-user-login="AnthonyGenovese" class="lia-mention lia-mention-user"&gt;AnthonyGenovese&lt;/a&gt;&amp;nbsp;... I m not sure if I understand about multiple roles w.r.t. to "Admin" and "Employee" view in RLS, if you can provide some sample or guidance that would be much helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;AnthonyJoseph&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 17:29:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bypass-RLS-through-DAX-in-Manage-roles-section/m-p/3426896#M129868</guid>
      <dc:creator>AnthonyJoseph</dc:creator>
      <dc:date>2023-09-12T17:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: Bypass RLS through DAX in Manage roles section</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bypass-RLS-through-DAX-in-Manage-roles-section/m-p/3426899#M129869</link>
      <description>&lt;P&gt;You can use an &lt;STRONG&gt;OR&lt;/STRONG&gt; condition in the DAX formula to check if the user is part of the "Admin" team. If they are, the RLS filter will not be applied.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;= 
(
    [user email] = USERPRINCIPALNAME() 
    || 
    LOOKUPVALUE('Admin_RolesAndPermissions'[Team], 'Admin_RolesAndPermissions'[user email], USERPRINCIPALNAME()) = "Admin"
)&lt;/LI-CODE&gt;&lt;P&gt;Just as a reminder to implement this, you would:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Go to the "Modeling" tab in Power BI Desktop.&lt;/LI&gt;&lt;LI&gt;Click on "Manage roles."&lt;/LI&gt;&lt;LI&gt;Create a new role or edit an existing one.&lt;/LI&gt;&lt;LI&gt;Paste the DAX filter expression next to the table where you want to apply RLS.&lt;/LI&gt;&lt;LI&gt;Save and close the "Manage roles" window.&lt;/LI&gt;&lt;LI&gt;Before publishing, you can view the report as roles to test the RLS.&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Tue, 12 Sep 2023 17:33:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bypass-RLS-through-DAX-in-Manage-roles-section/m-p/3426899#M129869</guid>
      <dc:creator>MargusMartsepp</dc:creator>
      <dc:date>2023-09-12T17:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: Bypass RLS through DAX in Manage roles section</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bypass-RLS-through-DAX-in-Manage-roles-section/m-p/3426900#M129870</link>
      <description>&lt;P&gt;They way we do RLS for admins, is we have an AD Group that all the admins are in. Then, we add a new role call admin, with read privilages. Add that AD group to that role and you are all done.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have to use a table like you described to find who the admins are, you have to do it in dax.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 17:34:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bypass-RLS-through-DAX-in-Manage-roles-section/m-p/3426900#M129870</guid>
      <dc:creator>AnthonyGenovese</dc:creator>
      <dc:date>2023-09-12T17:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Bypass RLS through DAX in Manage roles section</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bypass-RLS-through-DAX-in-Manage-roles-section/m-p/3426904#M129872</link>
      <description>&lt;P&gt;I approve doing this with an Active Directory Group.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 17:39:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Bypass-RLS-through-DAX-in-Manage-roles-section/m-p/3426904#M129872</guid>
      <dc:creator>MargusMartsepp</dc:creator>
      <dc:date>2023-09-12T17:39:24Z</dc:date>
    </item>
  </channel>
</rss>

