<?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: Counting Rows in Different Table based on Current Row Context in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-Rows-in-Different-Table-based-on-Current-Row-Context/m-p/4294573#M170446</link>
    <description>&lt;P&gt;Okay, so as always, I have managed to work it out by myself after a few days.&lt;BR /&gt;I will write down the solution so anyone else who experiences similar problems can have something to hopefully guide them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The Issue&lt;/STRONG&gt;: I am a very visual person and like seeing mid-calculations in tables. This is why I created the 'Results Table' using SUMMARIZE. I assumed that by creating this table all the previous relationships would still exist. However, what I believe is happening is that this new table is an entity on its own and therefore LOST the relationships with the other tables.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;The Solution&lt;/STRONG&gt;: I moved the SUMMARIZE dax code away from the new table and instead into its own measure. This kept the relationships between each of the other tables and allowed me to do a COUNTROWS between two tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT color="#3366FF"&gt;&lt;SPAN&gt;# Allocated Techs =&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#3366FF"&gt;&lt;SPAN&gt;COUNTROWS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#3366FF"&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Technician OEM Allocation'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#3366FF"&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'Technician OEM Allocation'&lt;/SPAN&gt;&lt;SPAN&gt;[Trained OEM]&lt;/SPAN&gt; &lt;SPAN&gt;IN&lt;/SPAN&gt; &lt;SPAN&gt;DISTINCT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Curriculum&lt;/SPAN&gt;&lt;SPAN&gt;[Training Make]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#3366FF"&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#3366FF"&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;Final result below. For my desired calculation (percentage) I can simply do a visual calculation.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 21 Nov 2024 06:02:16 GMT</pubDate>
    <dc:creator>Namdu_PAU</dc:creator>
    <dc:date>2024-11-21T06:02:16Z</dc:date>
    <item>
      <title>Counting Rows in Different Table based on Current Row Context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-Rows-in-Different-Table-based-on-Current-Row-Context/m-p/4292460#M170336</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First of all, thank you for taking your time to stop by and reading my help request!&lt;BR /&gt;I am an intermediate user of Power BI and have started to encounter difficulties with more complex logic with DAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Task:&amp;nbsp;&lt;/STRONG&gt;I would like to calculate the % of individuals in each branch that have completed the training course. To do that, I need to divide the &lt;FONT color="#0000FF"&gt;# users completed&lt;/FONT&gt; by the &lt;FONT color="#0000FF"&gt;# users allocated for training&lt;/FONT&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Problem:&amp;nbsp;&lt;/STRONG&gt;I cannot figure out the DAX code to find &lt;FONT color="#0000FF"&gt;# users allocated for training&lt;FONT color="#000000"&gt; that respects the row context in the matrix while looking at a different table that is related 2 steps away.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#000000"&gt;For example, lets say the first row calculation for Adelaide - Expert - Cert 2&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#000000"&gt;If i could write it in pseudocode, it'd be something like this:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;COUNTIF( USER[Location] = "Adelaide" &amp;amp;&amp;amp; USER[ALLOCATED] = "Cert 2") FROM All Allocated Users&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#000000"&gt;However, the confusing part for me is that the relationships are not defined clearly.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#000000"&gt;I have a table with every user, and then another table allocating users to a&amp;nbsp;&lt;FONT color="#0000FF"&gt;MAKE&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#000000"&gt;Then, I have a historical table for all training performed and another table explaining the structure of the training curriculum. This also has a &lt;FONT color="#0000FF"&gt;MAKE&lt;/FONT&gt; field.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The image below is a snippet of the table, the last column is simply a Count of all the User IDS from the &lt;FONT color="#FF0000"&gt;ALLOCATED USERS&lt;/FONT&gt; table and is returning the full list for every row in the table. I have tried many other DAX codes but cannot get it to simply count the number of users from the &lt;FONT color="#FF0000"&gt;ALLOCATED USERS&lt;/FONT&gt; table.&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;STRONG&gt;Datastructure:&lt;/STRONG&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;Allocated Users&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Curriculum&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Training History&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;&lt;P&gt;&lt;STRONG&gt;Link to PBIx&lt;/STRONG&gt;: (updated link)&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.dropbox.com/scl/fi/o3mjeaqyyukpb402lqhk7/PBI_Help_Counting-Users.pbix?rlkey=w52n2x3re2r0b5em6fb1g7fr3&amp;amp;st=2ngf8u85&amp;amp;dl=0" target="_blank"&gt;https://www.dropbox.com/scl/fi/o3mjeaqyyukpb402lqhk7/PBI_Help_Counting-Users.pbix?rlkey=w52n2x3re2r0b5em6fb1g7fr3&amp;amp;st=2ngf8u85&amp;amp;dl=0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All help is sincerely appreciated and I will try my best to reciprocate in the community when I get better myself with Power BI.&lt;/P&gt;&lt;P&gt;Thank you all again!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Namdu&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 21:47:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-Rows-in-Different-Table-based-on-Current-Row-Context/m-p/4292460#M170336</guid>
      <dc:creator>Namdu_PAU</dc:creator>
      <dc:date>2024-11-20T21:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: Counting Rows in Different Table based on Current Row Context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-Rows-in-Different-Table-based-on-Current-Row-Context/m-p/4292551#M170340</link>
      <description>&lt;H2&gt;Msg on Drop Box&lt;/H2&gt;&lt;H2&gt;This item was deleted&lt;/H2&gt;&lt;DIV class=""&gt;You might be able to find it in your deleted files. If it's not there, try asking the person who shared it with you.&lt;/DIV&gt;</description>
      <pubDate>Wed, 20 Nov 2024 06:39:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-Rows-in-Different-Table-based-on-Current-Row-Context/m-p/4292551#M170340</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2024-11-20T06:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: Counting Rows in Different Table based on Current Row Context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-Rows-in-Different-Table-based-on-Current-Row-Context/m-p/4292555#M170341</link>
      <description>&lt;P&gt;please check your drop box setting ... i cant reach that. or may sahre your data on one_drive.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 06:41:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-Rows-in-Different-Table-based-on-Current-Row-Context/m-p/4292555#M170341</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2024-11-20T06:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Counting Rows in Different Table based on Current Row Context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-Rows-in-Different-Table-based-on-Current-Row-Context/m-p/4294065#M170421</link>
      <description>&lt;P&gt;Hey 123abc,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That's so embarassing, i should have checked. I think I linked the previous version (which i deleted and updated).&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.dropbox.com/scl/fi/o3mjeaqyyukpb402lqhk7/PBI_Help_Counting-Users.pbix?rlkey=w52n2x3re2r0b5em6fb1g7fr3&amp;amp;st=8fwr0m93&amp;amp;dl=0" target="_blank"&gt;https://www.dropbox.com/scl/fi/o3mjeaqyyukpb402lqhk7/PBI_Help_Counting-Users.pbix?rlkey=w52n2x3re2r0b5em6fb1g7fr3&amp;amp;st=8fwr0m93&amp;amp;dl=0&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 21:46:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-Rows-in-Different-Table-based-on-Current-Row-Context/m-p/4294065#M170421</guid>
      <dc:creator>Namdu_PAU</dc:creator>
      <dc:date>2024-11-20T21:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: Counting Rows in Different Table based on Current Row Context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-Rows-in-Different-Table-based-on-Current-Row-Context/m-p/4294573#M170446</link>
      <description>&lt;P&gt;Okay, so as always, I have managed to work it out by myself after a few days.&lt;BR /&gt;I will write down the solution so anyone else who experiences similar problems can have something to hopefully guide them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The Issue&lt;/STRONG&gt;: I am a very visual person and like seeing mid-calculations in tables. This is why I created the 'Results Table' using SUMMARIZE. I assumed that by creating this table all the previous relationships would still exist. However, what I believe is happening is that this new table is an entity on its own and therefore LOST the relationships with the other tables.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;The Solution&lt;/STRONG&gt;: I moved the SUMMARIZE dax code away from the new table and instead into its own measure. This kept the relationships between each of the other tables and allowed me to do a COUNTROWS between two tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT color="#3366FF"&gt;&lt;SPAN&gt;# Allocated Techs =&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#3366FF"&gt;&lt;SPAN&gt;COUNTROWS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#3366FF"&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Technician OEM Allocation'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#3366FF"&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'Technician OEM Allocation'&lt;/SPAN&gt;&lt;SPAN&gt;[Trained OEM]&lt;/SPAN&gt; &lt;SPAN&gt;IN&lt;/SPAN&gt; &lt;SPAN&gt;DISTINCT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Curriculum&lt;/SPAN&gt;&lt;SPAN&gt;[Training Make]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#3366FF"&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#3366FF"&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;Final result below. For my desired calculation (percentage) I can simply do a visual calculation.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 21 Nov 2024 06:02:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-Rows-in-Different-Table-based-on-Current-Row-Context/m-p/4294573#M170446</guid>
      <dc:creator>Namdu_PAU</dc:creator>
      <dc:date>2024-11-21T06:02:16Z</dc:date>
    </item>
  </channel>
</rss>

