<?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 How to get the penultimate order date per customer from order data in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-penultimate-order-date-per-customer-from-order/m-p/2685489#M80610</link>
    <description>&lt;P&gt;Hi Guys,&lt;BR /&gt;I want to ask how to take out the penultimate order date of each customer,&lt;SPAN&gt;I have tried using the following formula,but doesn't work&amp;nbsp;&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;penultimate order date= &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;MIN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'order'[Order Date]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;TOPN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'order'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'order'[Order Date]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;thanks for all the tips and help&amp;nbsp;@!&lt;/P&gt;</description>
    <pubDate>Sun, 07 Aug 2022 05:54:23 GMT</pubDate>
    <dc:creator>tykio</dc:creator>
    <dc:date>2022-08-07T05:54:23Z</dc:date>
    <item>
      <title>How to get the penultimate order date per customer from order data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-penultimate-order-date-per-customer-from-order/m-p/2685489#M80610</link>
      <description>&lt;P&gt;Hi Guys,&lt;BR /&gt;I want to ask how to take out the penultimate order date of each customer,&lt;SPAN&gt;I have tried using the following formula,but doesn't work&amp;nbsp;&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;penultimate order date= &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;MIN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'order'[Order Date]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;TOPN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'order'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'order'[Order Date]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;thanks for all the tips and help&amp;nbsp;@!&lt;/P&gt;</description>
      <pubDate>Sun, 07 Aug 2022 05:54:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-penultimate-order-date-per-customer-from-order/m-p/2685489#M80610</guid>
      <dc:creator>tykio</dc:creator>
      <dc:date>2022-08-07T05:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the penultimate order date per customer from order data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-penultimate-order-date-per-customer-from-order/m-p/2685500#M80611</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&lt;/P&gt;
&lt;P&gt;I think there are many ways to solve the problem, but I tried to use TOPN function like what it is in your measure.&lt;/P&gt;
&lt;P&gt;Please check if it suits your requirement.&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;LI-CODE lang="markup"&gt;penultimate order date = 
IF (
    COUNTROWS ( 'Order' ) &amp;gt;= 2
        &amp;amp;&amp;amp; HASONEVALUE ( Customer[Customer ID] ),
    CALCULATE (
        MIN ( 'Order'[Order Date] ),
        KEEPFILTERS (
            TOPN (
                2,
                ALL ( 'Order'[Order Date] ),
                CALCULATE ( MAX ( 'Order'[Order Date] ) ), DESC
            )
        )
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Aug 2022 06:43:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-penultimate-order-date-per-customer-from-order/m-p/2685500#M80611</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-08-07T06:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the penultimate order date per customer from order data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-penultimate-order-date-per-customer-from-order/m-p/2685613#M80631</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Thanks for your reply &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; very useful&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;there is another question,&lt;/P&gt;&lt;P&gt;Is there an easier way if I want to output the results as a data rather than a report?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so many thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 07 Aug 2022 15:01:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-penultimate-order-date-per-customer-from-order/m-p/2685613#M80631</guid>
      <dc:creator>tykio</dc:creator>
      <dc:date>2022-08-07T15:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the penultimate order date per customer from order data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-penultimate-order-date-per-customer-from-order/m-p/2686038#M80678</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thank you for your message.&lt;/P&gt;
&lt;P&gt;Sorry that it is difficult to understand your last question.&lt;/P&gt;
&lt;P&gt;Could you please share your sample pbix file's link with how the expected result looks like?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 03:00:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-penultimate-order-date-per-customer-from-order/m-p/2686038#M80678</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-08-08T03:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the penultimate order date per customer from order data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-penultimate-order-date-per-customer-from-order/m-p/2686366#M80700</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp; thanks for reply ,p&lt;SPAN&gt;lease check the URL&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://drive.google.com/file/d/1sgll6K_YHXMRdU4VEPk3QQ8XckJCvu-l/view?usp=sharing" target="_blank"&gt;https://drive.google.com/file/d/1sgll6K_YHXMRdU4VEPk3QQ8XckJCvu-l/view?usp=sharing&lt;/A&gt;&lt;BR /&gt;I want to add the last consumption date and the penultimate consumption date to the &lt;FONT color="#FF0000"&gt;output&lt;/FONT&gt; data, and then calculate the member's consumption cycle.&lt;BR /&gt;Thanks for your kindly help&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 06:24:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-penultimate-order-date-per-customer-from-order/m-p/2686366#M80700</guid>
      <dc:creator>tykio</dc:creator>
      <dc:date>2022-08-08T06:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the penultimate order date per customer from order data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-penultimate-order-date-per-customer-from-order/m-p/2686408#M80706</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Sorry but your pbix file looks like below and I cannot proceed.&lt;/P&gt;
&lt;P&gt;Did you mean that you want to create a calcluated table instead of the visualization?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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;</description>
      <pubDate>Mon, 08 Aug 2022 06:45:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-penultimate-order-date-per-customer-from-order/m-p/2686408#M80706</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-08-08T06:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the penultimate order date per customer from order data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-penultimate-order-date-per-customer-from-order/m-p/2686505#M80714</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp;thanks for reply&lt;BR /&gt;&lt;BR /&gt;Yes,i&amp;nbsp;&lt;SPAN&gt;want to create a calcluated table &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; thanks for your help&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 07:29:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-penultimate-order-date-per-customer-from-order/m-p/2686505#M80714</guid>
      <dc:creator>tykio</dc:creator>
      <dc:date>2022-08-08T07:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the penultimate order date per customer from order data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-penultimate-order-date-per-customer-from-order/m-p/2686657#M80722</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&lt;/P&gt;
&lt;P&gt;It is for creating a new 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;LI-CODE lang="markup"&gt;New Table =
VAR _lastorderdate =
    ADDCOLUMNS (
        VALUES ( Customer[Customer ID] ),
        "@LastOrderDate",
            MAXX (
                FILTER ( 'Order', 'Order'[Customer ID] = EARLIER ( Customer[Customer ID] ) ),
                'Order'[Order Date]
            )
    )
VAR _penultimatedate =
    ADDCOLUMNS (
        _lastorderdate,
        "PenultimateOrderDate",
            MAXX (
                FILTER (
                    'Order',
                    'Order'[Customer ID] = EARLIER ( Customer[Customer ID] )
                        &amp;amp;&amp;amp; 'Order'[Order Date] &amp;lt; [@LastOrderDate]
                ),
                'Order'[Order Date]
            )
    )
RETURN
    _penultimatedate
&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 08 Aug 2022 08:27:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-penultimate-order-date-per-customer-from-order/m-p/2686657#M80722</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-08-08T08:27:37Z</dc:date>
    </item>
  </channel>
</rss>

