<?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 PATH-function for user/manager relation in combination with SCD2 in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PATH-function-for-user-manager-relation-in-combination-with-SCD2/m-p/3408683#M128813</link>
    <description>&lt;P&gt;Hello together,&lt;/P&gt;&lt;P&gt;i have some example data like the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;scdID    userID    userIDsupervisor  csdStartDate    scdEndDate
1        1                           2008-02-02        
2        2        1                  2009-03-04      2015-04-25
3        2        3                  2015-04-25        
4        3        2                  2010-05-03      2014-02-01
5        3        1                  2014-02-01         &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;scdID is a unique identifier but because of the slowly changing dimension userID is not.&lt;BR /&gt;I use a measure and date slider with a date table in background to filter the data to only see the data which is valid at a selected date. The measure is like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;isInDateRange =
    IF (
        MAX ( 'calendar'[Date] ) &amp;gt;= SELECTEDVALUE( 'dim_user'[csdStartDate] )
        &amp;amp;&amp;amp; (
            MIN ( 'calendar'[Date] ) &amp;lt;= SELECTEDVALUE( 'dim_user'[scdEndDate] )
            || ISBLANK( SELECTEDVALUE( 'dim_user'[scdEndDate] ) ) 
        )
        , 1, 0
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am filtering the visual with isInDateRange == 1. This works perfectly.&lt;BR /&gt;&lt;BR /&gt;But now I have the task to implement RowLevelSecurity so a manager can see al its childs but under consideration of the slowly changing dimension. So when I select a date I should only see data of people which where below me in hirachy at this cartain date.&lt;/P&gt;&lt;P&gt;I would like to use the PATH function in this context but of course it does not work right away because userID is not unique. So i tried this as a measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;ManagerPath =
    CALCULATE( PATH( 'dim_user'[userID], 'dim_user'[userIDsupervisor]), FILTER('dim_user', [isInDateRange]==1) )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this did not work. It results in the same error. Does someone has an idea how to solve this complex setting?&lt;/P&gt;&lt;P&gt;Thank you very much for every hint!&lt;BR /&gt;Jenesis&lt;/P&gt;</description>
    <pubDate>Thu, 31 Aug 2023 11:02:20 GMT</pubDate>
    <dc:creator>jenesis</dc:creator>
    <dc:date>2023-08-31T11:02:20Z</dc:date>
    <item>
      <title>PATH-function for user/manager relation in combination with SCD2</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PATH-function-for-user-manager-relation-in-combination-with-SCD2/m-p/3408683#M128813</link>
      <description>&lt;P&gt;Hello together,&lt;/P&gt;&lt;P&gt;i have some example data like the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;scdID    userID    userIDsupervisor  csdStartDate    scdEndDate
1        1                           2008-02-02        
2        2        1                  2009-03-04      2015-04-25
3        2        3                  2015-04-25        
4        3        2                  2010-05-03      2014-02-01
5        3        1                  2014-02-01         &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;scdID is a unique identifier but because of the slowly changing dimension userID is not.&lt;BR /&gt;I use a measure and date slider with a date table in background to filter the data to only see the data which is valid at a selected date. The measure is like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;isInDateRange =
    IF (
        MAX ( 'calendar'[Date] ) &amp;gt;= SELECTEDVALUE( 'dim_user'[csdStartDate] )
        &amp;amp;&amp;amp; (
            MIN ( 'calendar'[Date] ) &amp;lt;= SELECTEDVALUE( 'dim_user'[scdEndDate] )
            || ISBLANK( SELECTEDVALUE( 'dim_user'[scdEndDate] ) ) 
        )
        , 1, 0
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am filtering the visual with isInDateRange == 1. This works perfectly.&lt;BR /&gt;&lt;BR /&gt;But now I have the task to implement RowLevelSecurity so a manager can see al its childs but under consideration of the slowly changing dimension. So when I select a date I should only see data of people which where below me in hirachy at this cartain date.&lt;/P&gt;&lt;P&gt;I would like to use the PATH function in this context but of course it does not work right away because userID is not unique. So i tried this as a measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;ManagerPath =
    CALCULATE( PATH( 'dim_user'[userID], 'dim_user'[userIDsupervisor]), FILTER('dim_user', [isInDateRange]==1) )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this did not work. It results in the same error. Does someone has an idea how to solve this complex setting?&lt;/P&gt;&lt;P&gt;Thank you very much for every hint!&lt;BR /&gt;Jenesis&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 11:02:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PATH-function-for-user-manager-relation-in-combination-with-SCD2/m-p/3408683#M128813</guid>
      <dc:creator>jenesis</dc:creator>
      <dc:date>2023-08-31T11:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: PATH-function for user/manager relation in combination with SCD2</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PATH-function-for-user-manager-relation-in-combination-with-SCD2/m-p/3412176#M128996</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="610885" data-lia-user-login="jenesis" class="lia-mention lia-mention-user"&gt;jenesis&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please try the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Enhance Your Data Model:&lt;/STRONG&gt; It's important to enhance your data model to include unique identifiers for users. You could create a new column that concatenates the userID and scdID or another unique identifier.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Create a User Hierarchy:&lt;/STRONG&gt; With the enhanced data model, create a new hierarchy based on the newly generated unique identifier column&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Calculate Unique Manager Paths:&lt;/STRONG&gt; Create a measure to calculate unique manager paths using the newly created unique identifier column.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;LI-CODE lang="markup"&gt;ManagerPath =
VAR SelectedUser = SELECTEDVALUE('dim_user'[UniqueUserID])
RETURN
CALCULATE(
    PATH('dim_user'[UniqueUserID], 'dim_user'[UniqueUserIDsupervisor]),
    FILTER(
        ALL('dim_user'),
        [isInDateRange] == 1 &amp;amp;&amp;amp;
        'dim_user'[UniqueUserID] = SelectedUser
    )
)&lt;/LI-CODE&gt;&lt;P&gt;Should you require further details or information, please do not hesitate to reach out to me.&lt;/P&gt;</description>
      <pubDate>Sat, 02 Sep 2023 20:11:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PATH-function-for-user-manager-relation-in-combination-with-SCD2/m-p/3412176#M128996</guid>
      <dc:creator>Sahir_Maharaj</dc:creator>
      <dc:date>2023-09-02T20:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: PATH-function for user/manager relation in combination with SCD2</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PATH-function-for-user-manager-relation-in-combination-with-SCD2/m-p/3412177#M128997</link>
      <description>&lt;P&gt;Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.&lt;BR /&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt; &lt;BR /&gt;&lt;STRONG&gt;Please show the expected outcome&lt;/STRONG&gt; based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Sep 2023 20:12:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PATH-function-for-user-manager-relation-in-combination-with-SCD2/m-p/3412177#M128997</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-09-02T20:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: PATH-function for user/manager relation in combination with SCD2</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PATH-function-for-user-manager-relation-in-combination-with-SCD2/m-p/3415176#M129189</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="501067" data-lia-user-login="Sahir_Maharaj" class="lia-mention lia-mention-user"&gt;Sahir_Maharaj&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;thank you for your answer, but there is a problem why this solution will noch work perfectly (I think):&lt;/P&gt;&lt;P&gt;Let's say we have a user "X" and he has the manager "Y" at point in time 1&lt;/P&gt;&lt;P&gt;And this user "Y" has manager "Z" at this point. So the hirachy at point 1 would be: X -&amp;gt; Y -&amp;gt; Z&lt;/P&gt;&lt;P&gt;So now at point in time 2 the manager of user "Y" gets changed to "K". So the hirachy for X from point 2 should be X -&amp;gt; Y -&amp;gt; K.&lt;/P&gt;&lt;P&gt;But this will not trigger any new scd record for the user "X" so looking from the perspective of the old record of user "X" it will result in a wrong (old) PATH (X -&amp;gt; Y -&amp;gt; Z) even after point 2.&lt;BR /&gt;&lt;BR /&gt;Or do you see an error in my thinking in some way?&lt;BR /&gt;&lt;BR /&gt;I tried now another aproach which involves more data preparartion in our data factory. So my data model will now result in one table holding the scd-records for users and one additional table called scd-hirachy, which holds scd2 records for each user, updated whenever anything in the complete hirachy of one user changes.&lt;/P&gt;&lt;P&gt;So this table looks like:&lt;/P&gt;&lt;LI-CODE lang="java"&gt;scdIDhirachy   userID    hirachy   csdStartDate   scdEndDate
1              1         1         time1          null
2              2         2-1       time1          time3
3              2         2-3-1     time3          null
4              3         3-2-1     time2      	  time3
5              3         3-1       time3          null&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now i now there is all information correctly available in the data model at each point in time but I am not sure how the RLS query should loook like which checks if a user should the a specific record at a specific point in time which is determined by the date-slider.&amp;nbsp;&lt;BR /&gt;Do you think you can help me to get further with this?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 08:19:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PATH-function-for-user-manager-relation-in-combination-with-SCD2/m-p/3415176#M129189</guid>
      <dc:creator>jenesis</dc:creator>
      <dc:date>2023-09-05T08:19:49Z</dc:date>
    </item>
  </channel>
</rss>

