<?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: Calculate table: Last record of day for that subscription_id (Dax) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-table-Last-record-of-day-for-that-subscription-id-Dax/m-p/3388602#M127710</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="133502" data-lia-user-login="michellepace" class="lia-mention lia-mention-user"&gt;michellepace&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This should do the trick (existing table referred to as &lt;STRONG&gt;YourTable &lt;/STRONG&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NewTable =
CALCULATETABLE (
    YourTable,
    INDEX (
        1,
        SUMMARIZE (
            YourTable,
            YourTable[subscription_id],
            YourTable[Date],
            YourTable[datetime]
        ),
        ORDERBY ( YourTable[datetime], DESC ),
        DEFAULT,
        PARTITIONBY ( YourTable[Date], YourTable[subscription_id] )
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use &lt;STRONG&gt;INDEX&lt;/STRONG&gt; to select the latest datetime per combination of &lt;STRONG&gt;subscription_id&lt;/STRONG&gt; &amp;amp; &lt;STRONG&gt;Date&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
    <pubDate>Sun, 20 Aug 2023 08:35:35 GMT</pubDate>
    <dc:creator>OwenAuger</dc:creator>
    <dc:date>2023-08-20T08:35:35Z</dc:date>
    <item>
      <title>Calculate table: Last record of day for that subscription_id (Dax)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-table-Last-record-of-day-for-that-subscription-id-Dax/m-p/3388589#M127709</link>
      <description>&lt;P&gt;Hello there. I would like to use DAX to calculate a new table from the below - basically retaining all the yellow rows.&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;The logic:&lt;/STRONG&gt; For each subscription_id, keep its last record for the day (because that will tell me if it's currently on or off).&amp;nbsp; I've been struggling with this for hours, I'd really appreciate your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Input&lt;/STRONG&gt;: this entire table&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Output&lt;/STRONG&gt; (via calculated table): Only the yellow rows&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Logic&lt;/STRONG&gt;:&amp;nbsp;For each subscription_id, keep its last record for the day&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Aug 2023 06:58:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-table-Last-record-of-day-for-that-subscription-id-Dax/m-p/3388589#M127709</guid>
      <dc:creator>michellepace</dc:creator>
      <dc:date>2023-08-20T06:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate table: Last record of day for that subscription_id (Dax)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-table-Last-record-of-day-for-that-subscription-id-Dax/m-p/3388602#M127710</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="133502" data-lia-user-login="michellepace" class="lia-mention lia-mention-user"&gt;michellepace&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This should do the trick (existing table referred to as &lt;STRONG&gt;YourTable &lt;/STRONG&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NewTable =
CALCULATETABLE (
    YourTable,
    INDEX (
        1,
        SUMMARIZE (
            YourTable,
            YourTable[subscription_id],
            YourTable[Date],
            YourTable[datetime]
        ),
        ORDERBY ( YourTable[datetime], DESC ),
        DEFAULT,
        PARTITIONBY ( YourTable[Date], YourTable[subscription_id] )
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use &lt;STRONG&gt;INDEX&lt;/STRONG&gt; to select the latest datetime per combination of &lt;STRONG&gt;subscription_id&lt;/STRONG&gt; &amp;amp; &lt;STRONG&gt;Date&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Sun, 20 Aug 2023 08:35:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-table-Last-record-of-day-for-that-subscription-id-Dax/m-p/3388602#M127710</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2023-08-20T08:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate table: Last record of day for that subscription_id (Dax)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-table-Last-record-of-day-for-that-subscription-id-Dax/m-p/3388665#M127718</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="133502" data-lia-user-login="michellepace" class="lia-mention lia-mention-user"&gt;michellepace&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;You may also try&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Table 2 =
FILTER (
    'Table',
    'Table'[datetime]
        = CALCULATE (
            MAX ( 'Table'[datetime] ),
            ALLEXCEPT ( 'Table', 'Table'[Date], 'Table'[subscription_id] )
        )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 20 Aug 2023 10:41:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-table-Last-record-of-day-for-that-subscription-id-Dax/m-p/3388665#M127718</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-08-20T10:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate table: Last record of day for that subscription_id (Dax)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-table-Last-record-of-day-for-that-subscription-id-Dax/m-p/3389379#M127751</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="6799" data-lia-user-login="OwenAuger" class="lia-mention lia-mention-user"&gt;OwenAuger&lt;/a&gt;&amp;nbsp;. Thank you both very much for your reply. I ended up finding this little &lt;A href="https://youtu.be/QaodJFeX49k" target="_self"&gt;youtube video&lt;/A&gt; to show me how to do this in Power Query (without having to write code). I'm still really struggling with DAX, although&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;I could follow your code. And now that I have my (snapshot) table... I need to count the number of subcriptions and can't avoid DAX any longer. I'll post a new thread for this. Thank you very much once agian.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 06:27:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-table-Last-record-of-day-for-that-subscription-id-Dax/m-p/3389379#M127751</guid>
      <dc:creator>michellepace</dc:creator>
      <dc:date>2023-08-21T06:27:07Z</dc:date>
    </item>
  </channel>
</rss>

