<?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 Trouble using DAX to calculate properly between multiple active/inactive relationships in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trouble-using-DAX-to-calculate-properly-between-multiple-active/m-p/3702419#M143993</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to understand if leveraging the Power BI relationships is a good place to do this, or if it's better suited to something like Power Query, or if we just write a database query that gives the proper output. We've been trying to get away for having so many custom views in the database so I'm trying with in app relationships first.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my scenario, the data source is a relational database with several tables. We have unique IDs tied to individual users, and there is a People Table that holds all of the user information such as their Names. I have to retrieve the names for multiple fields, which means Power BI needs a mix of active and inactive relationships established. Screenshots of the relationships are at the bottom of the post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another workaround we thought of that I don't like is having multiple/separate queries pull the ID and Name from the people table and we have an active relationship and a new query for every named individual I'm trying to surface.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The main active relationship I started with was joining 'report er_log' [lead_project_manger_id] to 'report people' [id]. I'm using a simple IF statement that successfully returns the Lead Project Manager name when those two IDs match - success!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Lead PM Name =&lt;/SPAN&gt; &lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'report er_log'&lt;/SPAN&gt;&lt;SPAN&gt;[lead_project_manager_id]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;RELATED&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'report people'&lt;/SPAN&gt;&lt;SPAN&gt;[id]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;RELATED&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'report people'&lt;/SPAN&gt;&lt;SPAN&gt;[full_name]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue comes in for the inactive relationship between 'report activity' [record_owner_id] to&amp;nbsp;'report people' [id]. Any formula I've used that didn't throw a relationship error will ignore the inactive relationship entirely and just return the PM Name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;my latest attempt was using LOOKUPVALUE. my understanding is that LOOKUPVALUE should ignore relationships but it definitely doesnt and just gives me PM names and not all record owners&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;LOOKUPVALUE('report people'[display_name],'report people'[id],'report activity'[record_owner_id])&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;My first attempt was using a simple IF statement. this also just returns PM names and has issues because RELATED only likes the active relationships&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;IF('report activity'[record_owner_id]=RELATED('report people'[id]),RELATED('report people'[full_name]))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;The only thing i found that might work for the USERLATIONSHIP function throws an error because in this context there's no active relationship with report people&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;(&lt;SPAN&gt;RELATED&lt;/SPAN&gt;('report people'[display name]),&lt;SPAN&gt;USERELATIONSHIP&lt;/SPAN&gt;('report activity'[record_owner_id],'report people'[id]))&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas are appreciated. I'm starting to play with Power Query, and worst case I think my workaround will be fine... I just don't want to have so many distinct queries going to report people if we can help it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: I tried the workaround for funsies and it seems like the same relationship issue with the original people table is still causing heartache.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Feb 2024 21:38:41 GMT</pubDate>
    <dc:creator>wboyle</dc:creator>
    <dc:date>2024-02-15T21:38:41Z</dc:date>
    <item>
      <title>Trouble using DAX to calculate properly between multiple active/inactive relationships</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trouble-using-DAX-to-calculate-properly-between-multiple-active/m-p/3702419#M143993</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to understand if leveraging the Power BI relationships is a good place to do this, or if it's better suited to something like Power Query, or if we just write a database query that gives the proper output. We've been trying to get away for having so many custom views in the database so I'm trying with in app relationships first.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my scenario, the data source is a relational database with several tables. We have unique IDs tied to individual users, and there is a People Table that holds all of the user information such as their Names. I have to retrieve the names for multiple fields, which means Power BI needs a mix of active and inactive relationships established. Screenshots of the relationships are at the bottom of the post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another workaround we thought of that I don't like is having multiple/separate queries pull the ID and Name from the people table and we have an active relationship and a new query for every named individual I'm trying to surface.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The main active relationship I started with was joining 'report er_log' [lead_project_manger_id] to 'report people' [id]. I'm using a simple IF statement that successfully returns the Lead Project Manager name when those two IDs match - success!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Lead PM Name =&lt;/SPAN&gt; &lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'report er_log'&lt;/SPAN&gt;&lt;SPAN&gt;[lead_project_manager_id]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;RELATED&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'report people'&lt;/SPAN&gt;&lt;SPAN&gt;[id]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;RELATED&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'report people'&lt;/SPAN&gt;&lt;SPAN&gt;[full_name]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue comes in for the inactive relationship between 'report activity' [record_owner_id] to&amp;nbsp;'report people' [id]. Any formula I've used that didn't throw a relationship error will ignore the inactive relationship entirely and just return the PM Name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;my latest attempt was using LOOKUPVALUE. my understanding is that LOOKUPVALUE should ignore relationships but it definitely doesnt and just gives me PM names and not all record owners&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;LOOKUPVALUE('report people'[display_name],'report people'[id],'report activity'[record_owner_id])&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;My first attempt was using a simple IF statement. this also just returns PM names and has issues because RELATED only likes the active relationships&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;IF('report activity'[record_owner_id]=RELATED('report people'[id]),RELATED('report people'[full_name]))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;The only thing i found that might work for the USERLATIONSHIP function throws an error because in this context there's no active relationship with report people&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;(&lt;SPAN&gt;RELATED&lt;/SPAN&gt;('report people'[display name]),&lt;SPAN&gt;USERELATIONSHIP&lt;/SPAN&gt;('report activity'[record_owner_id],'report people'[id]))&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas are appreciated. I'm starting to play with Power Query, and worst case I think my workaround will be fine... I just don't want to have so many distinct queries going to report people if we can help it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: I tried the workaround for funsies and it seems like the same relationship issue with the original people table is still causing heartache.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 21:38:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trouble-using-DAX-to-calculate-properly-between-multiple-active/m-p/3702419#M143993</guid>
      <dc:creator>wboyle</dc:creator>
      <dc:date>2024-02-15T21:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble using DAX to calculate properly between multiple active/inactive relationships</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trouble-using-DAX-to-calculate-properly-between-multiple-active/m-p/3702814#M144011</link>
      <description>&lt;P&gt;Have you considered refactoring your data model and using RLS ?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2024 02:41:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trouble-using-DAX-to-calculate-properly-between-multiple-active/m-p/3702814#M144011</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-02-16T02:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble using DAX to calculate properly between multiple active/inactive relationships</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trouble-using-DAX-to-calculate-properly-between-multiple-active/m-p/3704521#M144101</link>
      <description>&lt;P&gt;Yeah I'm leaning towards in app relationships are the wrong solution for this. Changing the data model outside of a custom query or database view won't happen with this system due to politics and reasons.&lt;/P&gt;&lt;P&gt;RLS meaning row level security? I haven't looked into that much myself but a team member has, I'll make a note to ask.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2024 17:33:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trouble-using-DAX-to-calculate-properly-between-multiple-active/m-p/3704521#M144101</guid>
      <dc:creator>wboyle</dc:creator>
      <dc:date>2024-02-16T17:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble using DAX to calculate properly between multiple active/inactive relationships</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trouble-using-DAX-to-calculate-properly-between-multiple-active/m-p/3708612#M144279</link>
      <description>&lt;P&gt;Closing the loop in case anyone comes across this thread with a similar issue. I ended up solving the in-app problem by making all of the relationships for people names inactive. This made the LOOKUP formula return proper results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 16:42:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trouble-using-DAX-to-calculate-properly-between-multiple-active/m-p/3708612#M144279</guid>
      <dc:creator>wboyle</dc:creator>
      <dc:date>2024-02-19T16:42:53Z</dc:date>
    </item>
  </channel>
</rss>

