<?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: Finding most recent task of a certain type on Table B for a case in table A. in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-most-recent-task-of-a-certain-type-on-Table-B-for-a-case/m-p/3209724#M117041</link>
    <description>&lt;P&gt;That did it! Thank you very much, that's incredibly helpful. Great job!&lt;/P&gt;</description>
    <pubDate>Thu, 27 Apr 2023 15:49:03 GMT</pubDate>
    <dc:creator>Singularity9</dc:creator>
    <dc:date>2023-04-27T15:49:03Z</dc:date>
    <item>
      <title>Finding most recent task of a certain type on Table B for a case in table A.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-most-recent-task-of-a-certain-type-on-Table-B-for-a-case/m-p/3207684#M116888</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Hi. I have two tables, Case and Case Task History. A has a list of cases. B has a list of tasks performed for cases. They are linked via case ref, on a a both-ways one to many relationship.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I want to create a column on the Case table which will tell me the most recent task for each case on Case Task History. However I only want it to look for 4 types of task - let's call them Type A, Type B, Type C and Type D. All others should be ignored. So for example if we have this:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;01/02/2023&amp;nbsp; &amp;nbsp; Type A&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;02/02/2023&amp;nbsp; &amp;nbsp; Type C&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;03/02/2023&amp;nbsp; &amp;nbsp; Type H&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I would want the formula to return "Type C".&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Below is the Dax I'm using for this. It doesn't work. As far as I can tell it's returning the most recent task of &lt;U&gt;any&lt;/U&gt; type, and if that's not one of the types I specify, it just returns a blank. So for the above example, it would return a blank, because Type H is the most recent task. Does anyone know how to fix this? Thanks in advance.&lt;BR /&gt;&lt;BR /&gt;Latest Task = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;_caseref&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;'CASE'[Case Ref]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;_maxdate&lt;/SPAN&gt;&lt;SPAN&gt; =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;'CASE TASK HISTORY'[GTH Performed Datetime]&lt;/SPAN&gt;&lt;SPAN&gt; ), &lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;'CASE TASK HISTORY'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'CASE TASK HISTORY'[Case Ref]&lt;/SPAN&gt;&lt;SPAN&gt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SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"Type D"&lt;/SPAN&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;amp;&amp;amp; &lt;/SPAN&gt;&lt;SPAN&gt;'CASE TASK HISTORY'[GTH Performed Datetime]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;_maxdate&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;_mostrecentsubmissiontask&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 26 Apr 2023 16:27:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-most-recent-task-of-a-certain-type-on-Table-B-for-a-case/m-p/3207684#M116888</guid>
      <dc:creator>Singularity9</dc:creator>
      <dc:date>2023-04-26T16:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: Finding most recent task of a certain type on Table B for a case in table A.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-most-recent-task-of-a-certain-type-on-Table-B-for-a-case/m-p/3207748#M116898</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="547917" data-lia-user-login="Singularity9" class="lia-mention lia-mention-user"&gt;Singularity9&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try&lt;/P&gt;
&lt;P&gt;Latest Task =&lt;BR /&gt;VAR CaseRef = 'CASE'[Case Ref]&lt;BR /&gt;VAR T1 =&lt;BR /&gt;FILTER (&lt;BR /&gt;'CASE TASK HISTORY',&lt;BR /&gt;'CASE TASK HISTORY'[Case Ref] = _caseref&lt;BR /&gt;&amp;amp;&amp;amp; 'CASE TASK HISTORY'[GTH Task Name] IN { "Type A", "Type B", "Type C", "Type D" }&lt;BR /&gt;)&lt;BR /&gt;VAR T2 =&lt;BR /&gt;TOPN ( T1, 'CASE TASK HISTORY'[GTH Performed Datetime] )&lt;BR /&gt;RETURN&lt;BR /&gt;MAXX ( T2, 'CASE TASK HISTORY'[GTH Task Name] )&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 17:19:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-most-recent-task-of-a-certain-type-on-Table-B-for-a-case/m-p/3207748#M116898</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-04-26T17:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Finding most recent task of a certain type on Table B for a case in table A.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-most-recent-task-of-a-certain-type-on-Table-B-for-a-case/m-p/3209146#M116988</link>
      <description>&lt;P&gt;Thanks for the help. I'm afraid this below part doesn't work, as the second argument in TOPN needs to be a table, not a column:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;VAR T2 =&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TOPN ( T1, 'CASE TASK HISTORY'[GTH Performed Datetime] )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When I change it to this:&lt;BR /&gt;&lt;BR /&gt;VAR T2 =&lt;BR /&gt;TOPN ( T1, 'CASE TASK HISTORY', [GTH Performed Datetime])&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;...then it is no longer underlined as an error, but then when I run the formula I get "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value."&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2023 11:28:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-most-recent-task-of-a-certain-type-on-Table-B-for-a-case/m-p/3209146#M116988</guid>
      <dc:creator>Singularity9</dc:creator>
      <dc:date>2023-04-27T11:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: Finding most recent task of a certain type on Table B for a case in table A.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-most-recent-task-of-a-certain-type-on-Table-B-for-a-case/m-p/3209661#M117038</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="547917" data-lia-user-login="Singularity9" class="lia-mention lia-mention-user"&gt;Singularity9&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Apologies, that was a typo mistake, I was actually typing on my phone and missed the N argument of TOPN. Please try&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Latest Task =
VAR CaseRef = 'CASE'[Case Ref]
VAR T1 =
    FILTER (
        'CASE TASK HISTORY',
        'CASE TASK HISTORY'[Case Ref] = _caseref
            &amp;amp;&amp;amp; 'CASE TASK HISTORY'[GTH Task Name] IN { "Type A", "Type B", "Type C", "Type D" }
    )
VAR T2 =
    TOPN ( 1, T1, 'CASE TASK HISTORY'[GTH Performed Datetime] )
RETURN
    MAXX ( T2, 'CASE TASK HISTORY'[GTH Task Name] )&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 27 Apr 2023 15:30:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-most-recent-task-of-a-certain-type-on-Table-B-for-a-case/m-p/3209661#M117038</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-04-27T15:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: Finding most recent task of a certain type on Table B for a case in table A.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-most-recent-task-of-a-certain-type-on-Table-B-for-a-case/m-p/3209724#M117041</link>
      <description>&lt;P&gt;That did it! Thank you very much, that's incredibly helpful. Great job!&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2023 15:49:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-most-recent-task-of-a-certain-type-on-Table-B-for-a-case/m-p/3209724#M117041</guid>
      <dc:creator>Singularity9</dc:creator>
      <dc:date>2023-04-27T15:49:03Z</dc:date>
    </item>
  </channel>
</rss>

