<?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: Parent-Child Filtering In a Many-to-Many Model in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Parent-Child-Filtering-In-a-Many-to-Many-Model/m-p/4335923#M172172</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="902206" data-lia-user-login="MattyZDBA" class="lia-mention lia-mention-user"&gt;MattyZDBA&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Whether the advice given by&amp;nbsp;lbendlin&amp;nbsp;has solved your confusion, if the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;</description>
    <pubDate>Thu, 19 Dec 2024 02:18:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-12-19T02:18:17Z</dc:date>
    <item>
      <title>Parent-Child Filtering In a Many-to-Many Model</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Parent-Child-Filtering-In-a-Many-to-Many-Model/m-p/4331679#M171966</link>
      <description>&lt;P&gt;I'm working on a dashboard reporting Absences organization wide. Below is a baseline data model based on our timekeeping software's data tier.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In essence, we have a hierarchical org chart (OrgPath), with Employees mapped to one node at any time. Some employees are managers and are assigned AccessGroup containers which are mapped to 1+ OrgPaths.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The intention of the dashboard is for RLS to filter the dashboard based on USERNAME() or another function to only display personnel in OrgPaths that are directly part of the manager's access group, AND for any child OrgPaths for those explicit parent OrgPaths.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Building the PATH for the OrgPath is straightforward in DAX, but in RLS, I've tried using SELECTEDVALUE in this fashion but no luck&lt;/P&gt;&lt;P&gt;&amp;nbsp; OrgPaths[OrgPathID] IN PATH(SELECTEDVALUE(AccessGroupsOrgPathsMM(OrgPathID), OrgPaths[ParentOrgPathID])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What should be the DAX expression to filter the Absences table on Employees belonging to the 1+ OrgPaths part of the manager's selected AccessGroup?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERD below&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;T-SQL DDL for the model is here.&lt;/P&gt;&lt;DIV&gt;CREATE SCHEMA AbsenceDashboard&lt;/DIV&gt;&lt;DIV&gt;GO&lt;/DIV&gt;&lt;DIV&gt;CREATE TABLE AbsenceDashboard.OrgPaths&lt;/DIV&gt;&lt;DIV&gt;(&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;OrgPathID int IDENTITY(1,1) NOT NULL PRIMARY KEY,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;OrgPath varchar(50),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ParentOrgPathId int&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;)&lt;/DIV&gt;&lt;DIV&gt;CREATE TABLE AbsenceDashboard.Employees&lt;/DIV&gt;&lt;DIV&gt;(&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;EmployeeID int IDENTITY(1,1) NOT NULL PRIMARY KEY,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;EmployeeName varchar(50),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;OrgPathID int NOT NULL,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ManagerID int&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;)&lt;/DIV&gt;&lt;DIV&gt;GO&lt;/DIV&gt;&lt;DIV&gt;ALTER TABLE AbsenceDashboard.Employees&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ADD CONSTRAINT FK_1 FOREIGN KEY(OrgPathID) REFERENCES AbsenceDashboard.OrgPaths(OrgPathID)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;GO&lt;/DIV&gt;&lt;DIV&gt;CREATE TABLE AbsenceDashboard.AccessGroups&lt;/DIV&gt;&lt;DIV&gt;(&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AccessGroupID int IDENTITY(1,1) NOT NULL PRIMARY KEY,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AccessGroup varchar(50)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;)&lt;/DIV&gt;&lt;DIV&gt;CREATE TABLE AbsenceDashboard.EmployeeAccessGroupsMM&lt;/DIV&gt;&lt;DIV&gt;(&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;EmployeeID int NOT NULL,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AccessGroupID int NOT NULL&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;)&lt;/DIV&gt;&lt;DIV&gt;ALTER TABLE AbsenceDashboard.EmployeeAccessGroupsMM&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ADD CONSTRAINT FK_2 FOREIGN KEY(EmployeeID) REFERENCES AbsenceDashboard.Employees(EmployeeID)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;GO&lt;/DIV&gt;&lt;DIV&gt;ALTER TABLE AbsenceDashboard.EmployeeAccessGroupsMM&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ADD CONSTRAINT FK_3 FOREIGN KEY(AccessGroupID) REFERENCES AbsenceDashboard.AccessGroups(AccessGroupID)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;GO&lt;/DIV&gt;&lt;DIV&gt;CREATE TABLE AbsenceDashboard.AccessGroupsOrgPathsMM&lt;/DIV&gt;&lt;DIV&gt;(&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AccessGroupID int NOT NULL,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;OrgPathID int NOT NULL&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;)&lt;/DIV&gt;&lt;DIV&gt;GO&lt;/DIV&gt;&lt;DIV&gt;ALTER TABLE AbsenceDashboard.AccessGroupsOrgPathsMM&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ADD CONSTRAINT FK_4 FOREIGN KEY(OrgPathID) REFERENCES AbsenceDashboard.AbsenceDashboard(OrgPathID)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;GO&lt;/DIV&gt;&lt;DIV&gt;ALTER TABLE AbsenceDashboard.AccessGroupsOrgPathsMM&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ADD CONSTRAINT FK_5 FOREIGN KEY(AccessGroupID) REFERENCES AbsenceDashboard.AccessGroups(AccessGroupID)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;GO&lt;/DIV&gt;&lt;DIV&gt;CREATE TABLE AbsenceDashboard.Absences&lt;/DIV&gt;&lt;DIV&gt;(&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AbsenceID int NOT NULL PRIMARY KEY,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;EmployeeID int,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DateAbsent date,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DateReported datetime DEFAULT GETDATE()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;)&lt;/DIV&gt;&lt;DIV&gt;ALTER TABLE AbsenceDashboard.Absences&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ADD CONSTRAINT FK_6 FOREIGN KEY(EmployeeID) REFERENCES AbsenceDashboard.Employees(EmployeeID)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;GO&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 23:00:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Parent-Child-Filtering-In-a-Many-to-Many-Model/m-p/4331679#M171966</guid>
      <dc:creator>MattyZDBA</dc:creator>
      <dc:date>2024-12-16T23:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Parent-Child Filtering In a Many-to-Many Model</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Parent-Child-Filtering-In-a-Many-to-Many-Model/m-p/4331714#M171969</link>
      <description>&lt;P&gt;1. I don't see a M:M&amp;nbsp; in your data model&lt;/P&gt;
&lt;P&gt;2. there is no "parent"&amp;nbsp; or "child"&amp;nbsp; in a M:M - both sides are equal rights citizens.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 23:23:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Parent-Child-Filtering-In-a-Many-to-Many-Model/m-p/4331714#M171969</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-12-16T23:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Parent-Child Filtering In a Many-to-Many Model</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Parent-Child-Filtering-In-a-Many-to-Many-Model/m-p/4333410#M172052</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Updated ERD here. The core M:M relationship should be in AccessGroupOrgPaths. A given Access Group can have one ore more associated OrgPaths, while a given OrgPath can be associated with 1+ Access Groups. The typical scenario would be a VP in the org having an access group which is a superset of the orgpaths for a Director that reports to the VP. In practice, an employee should only be assigned one access group but i modeled for more than one in case of ad-hoc or temporary requirements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 15:52:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Parent-Child-Filtering-In-a-Many-to-Many-Model/m-p/4333410#M172052</guid>
      <dc:creator>MattyZDBA</dc:creator>
      <dc:date>2024-12-17T15:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: Parent-Child Filtering In a Many-to-Many Model</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Parent-Child-Filtering-In-a-Many-to-Many-Model/m-p/4333455#M172054</link>
      <description>&lt;P&gt;For these scenarios you would use dynamic RLS rather than static RLS. You would have an externally maintained reference table that lists all access mappings for each USERPRINCIPALNAME&amp;nbsp; (email address, basically).&amp;nbsp; This gives you full flexibility to map the corner cases.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 16:20:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Parent-Child-Filtering-In-a-Many-to-Many-Model/m-p/4333455#M172054</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-12-17T16:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: Parent-Child Filtering In a Many-to-Many Model</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Parent-Child-Filtering-In-a-Many-to-Many-Model/m-p/4335923#M172172</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="902206" data-lia-user-login="MattyZDBA" class="lia-mention lia-mention-user"&gt;MattyZDBA&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Whether the advice given by&amp;nbsp;lbendlin&amp;nbsp;has solved your confusion, if the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 02:18:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Parent-Child-Filtering-In-a-Many-to-Many-Model/m-p/4335923#M172172</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-19T02:18:17Z</dc:date>
    </item>
  </channel>
</rss>

