<?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 Difference in Calculated table and RLS in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-in-Calculated-table-and-RLS/m-p/820764#M5596</link>
    <description>&lt;P&gt;I'm having some trouble with creating an RLS Role for managing which department a user may view employees from.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table of departments built like paths, IE:&lt;/P&gt;&lt;P&gt;Dep1/&lt;/P&gt;&lt;P&gt;Dep1/Site1&lt;/P&gt;&lt;P&gt;Dep1/Site1/Team1&lt;/P&gt;&lt;P&gt;Dep1/Site1/Team2&lt;/P&gt;&lt;P&gt;Dep1/Site2&lt;/P&gt;&lt;P&gt;Dep1/Site2/Team3&lt;/P&gt;&lt;P&gt;Dep1/Site2/Team4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each row has a manager, which matches ids in my usertable. For a manager to be able to access departments below them I create a calculated column in the departments table so that Column = Manager &amp;amp; ParentManager &amp;amp; GrandParentManager.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my role filter is: (OrganizationalEntity is department and Solution is my aggregated column)&lt;/P&gt;&lt;PRE&gt;VAR USERID =
CALCULATE(
 FIRSTNONBLANK( SystemUser[systemuserid], 1),
 FILTER( ALL( SystemUser ), SystemUser[Domain Name] = USERPRINCIPALNAME()
 )
)

RETURN
IF(
IFERROR(SEARCH(USERID, OrganizationalEntity[Solution]), -1) &amp;gt; -1,
TRUE,
FALSE
)&lt;/PRE&gt;&lt;P&gt;But this simply leaves me with all departments with a nonblank "Solution" column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I instead create a calculated table, use the same definition for USERID but swap userprincipalname() for my email, like this:&lt;/P&gt;&lt;PRE&gt;TestTable = 

VAR USERID =
CALCULATE(
 FIRSTNONBLANK( SystemUser[systemuserid]; 1);
 FILTER( ALL( SystemUser ); SystemUser[Domain Name] = "MYEMAIL@DOMAIN.COM"
 )
)

RETURN
    CALCULATETABLE(
        OrganizationalEntity;
        FILTER(
            OrganizationalEntity;
            IF(
            IFERROR(SEARCH(USERID; OrganizationalEntity[Solution]); -1) &amp;gt; -1;
            TRUE;
            FALSE
            )
        )
    )&lt;/PRE&gt;&lt;P&gt;This generates a table with expected results.&lt;/P&gt;&lt;P&gt;Is this a bug? Or am I just missing something?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: I want to add that I have tried simply OrganizationalEntity[Manager] = USERID, and that works as expected in RLS, so USERID seems to be correct.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Oct 2019 10:31:35 GMT</pubDate>
    <dc:creator>eliebe-5</dc:creator>
    <dc:date>2019-10-17T10:31:35Z</dc:date>
    <item>
      <title>Difference in Calculated table and RLS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-in-Calculated-table-and-RLS/m-p/820764#M5596</link>
      <description>&lt;P&gt;I'm having some trouble with creating an RLS Role for managing which department a user may view employees from.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table of departments built like paths, IE:&lt;/P&gt;&lt;P&gt;Dep1/&lt;/P&gt;&lt;P&gt;Dep1/Site1&lt;/P&gt;&lt;P&gt;Dep1/Site1/Team1&lt;/P&gt;&lt;P&gt;Dep1/Site1/Team2&lt;/P&gt;&lt;P&gt;Dep1/Site2&lt;/P&gt;&lt;P&gt;Dep1/Site2/Team3&lt;/P&gt;&lt;P&gt;Dep1/Site2/Team4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each row has a manager, which matches ids in my usertable. For a manager to be able to access departments below them I create a calculated column in the departments table so that Column = Manager &amp;amp; ParentManager &amp;amp; GrandParentManager.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my role filter is: (OrganizationalEntity is department and Solution is my aggregated column)&lt;/P&gt;&lt;PRE&gt;VAR USERID =
CALCULATE(
 FIRSTNONBLANK( SystemUser[systemuserid], 1),
 FILTER( ALL( SystemUser ), SystemUser[Domain Name] = USERPRINCIPALNAME()
 )
)

RETURN
IF(
IFERROR(SEARCH(USERID, OrganizationalEntity[Solution]), -1) &amp;gt; -1,
TRUE,
FALSE
)&lt;/PRE&gt;&lt;P&gt;But this simply leaves me with all departments with a nonblank "Solution" column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I instead create a calculated table, use the same definition for USERID but swap userprincipalname() for my email, like this:&lt;/P&gt;&lt;PRE&gt;TestTable = 

VAR USERID =
CALCULATE(
 FIRSTNONBLANK( SystemUser[systemuserid]; 1);
 FILTER( ALL( SystemUser ); SystemUser[Domain Name] = "MYEMAIL@DOMAIN.COM"
 )
)

RETURN
    CALCULATETABLE(
        OrganizationalEntity;
        FILTER(
            OrganizationalEntity;
            IF(
            IFERROR(SEARCH(USERID; OrganizationalEntity[Solution]); -1) &amp;gt; -1;
            TRUE;
            FALSE
            )
        )
    )&lt;/PRE&gt;&lt;P&gt;This generates a table with expected results.&lt;/P&gt;&lt;P&gt;Is this a bug? Or am I just missing something?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: I want to add that I have tried simply OrganizationalEntity[Manager] = USERID, and that works as expected in RLS, so USERID seems to be correct.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 10:31:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-in-Calculated-table-and-RLS/m-p/820764#M5596</guid>
      <dc:creator>eliebe-5</dc:creator>
      <dc:date>2019-10-17T10:31:35Z</dc:date>
    </item>
  </channel>
</rss>

