<?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 Finding customer status for a given date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-customer-status-for-a-given-date/m-p/3062073#M105845</link>
    <description>&lt;P&gt;Hi Masters,&lt;BR /&gt;Given is a table of status changes of customers (Old Status, New Status, Change Date, Previous Change Date) as described:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Also given is the column "First Purchase Date" which is &lt;U&gt;constant for each Customer ID&lt;/U&gt;.&lt;BR /&gt;I wish to add a calculated column which will return the customer status of each customer while his first purchase.&lt;BR /&gt;in the example above, customer 123 first purchase date is 15/01/2022. therefore, according to his status changes dates his status while first purchase was "b" (15/1/2022 is between 01/01/2022 and 01/02/2022)&lt;BR /&gt;&lt;BR /&gt;thanks for helping out.&lt;BR /&gt;Amit&lt;/P&gt;</description>
    <pubDate>Sun, 05 Feb 2023 06:28:11 GMT</pubDate>
    <dc:creator>akfir</dc:creator>
    <dc:date>2023-02-05T06:28:11Z</dc:date>
    <item>
      <title>Finding customer status for a given date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-customer-status-for-a-given-date/m-p/3062073#M105845</link>
      <description>&lt;P&gt;Hi Masters,&lt;BR /&gt;Given is a table of status changes of customers (Old Status, New Status, Change Date, Previous Change Date) as described:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Also given is the column "First Purchase Date" which is &lt;U&gt;constant for each Customer ID&lt;/U&gt;.&lt;BR /&gt;I wish to add a calculated column which will return the customer status of each customer while his first purchase.&lt;BR /&gt;in the example above, customer 123 first purchase date is 15/01/2022. therefore, according to his status changes dates his status while first purchase was "b" (15/1/2022 is between 01/01/2022 and 01/02/2022)&lt;BR /&gt;&lt;BR /&gt;thanks for helping out.&lt;BR /&gt;Amit&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 06:28:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-customer-status-for-a-given-date/m-p/3062073#M105845</guid>
      <dc:creator>akfir</dc:creator>
      <dc:date>2023-02-05T06:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: Finding customer status for a given date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-customer-status-for-a-given-date/m-p/3062093#M105847</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="191221" data-lia-user-login="akfir" class="lia-mention lia-mention-user"&gt;akfir&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try to add a column like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;StatusWhileFirstPurhcase2 = 
VAR _customer = [CustomerID]
VAR _firstdate = [FirstPurchaseDate]
RETURN
MAXX(
    FILTER(
        TableName,
        TableName[CustomerID]=_customer
            &amp;amp;&amp;amp;TableName[StatusChangeDate]&amp;gt;=_firstdate
            &amp;amp;&amp;amp;TableName[PreviousChangeDate]&amp;lt;=_firstdate
    ),
    TableName[OldStatus]
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i worked like:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 07:09:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-customer-status-for-a-given-date/m-p/3062093#M105847</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-02-05T07:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Finding customer status for a given date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-customer-status-for-a-given-date/m-p/3062097#M105848</link>
      <description>&lt;P&gt;thanks for your quick reply!&lt;BR /&gt;it seems good but fail to show values in cases where FIRST PURCHASE DATE is larger than any status change date and then it returns BLANK instead of i guess NEW Status&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 07:29:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-customer-status-for-a-given-date/m-p/3062097#M105848</guid>
      <dc:creator>akfir</dc:creator>
      <dc:date>2023-02-05T07:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: Finding customer status for a given date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-customer-status-for-a-given-date/m-p/3062110#M105850</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="191221" data-lia-user-login="akfir" class="lia-mention lia-mention-user"&gt;akfir&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;could you enrich your sample data and let us see how it works?&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 08:01:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-customer-status-for-a-given-date/m-p/3062110#M105850</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-02-05T08:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Finding customer status for a given date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-customer-status-for-a-given-date/m-p/3062117#M105852</link>
      <description>&lt;P&gt;yes please.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;have a look in customer 456. First Purchase Date is later than latest Status change date. therefore value should be "d"&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 08:07:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-customer-status-for-a-given-date/m-p/3062117#M105852</guid>
      <dc:creator>akfir</dc:creator>
      <dc:date>2023-02-05T08:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Finding customer status for a given date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-customer-status-for-a-given-date/m-p/3062130#M105856</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="191221" data-lia-user-login="akfir" class="lia-mention lia-mention-user"&gt;akfir&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then try like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;StatusWhileFirstPurhcase2 = 
VAR _customer = [CustomerID]
VAR _firstdate = [FirstPurchaseDate]
VAR _value1 = 
MAXX(
    FILTER(
        TableName,
        TableName[CustomerID]=_customer
            &amp;amp;&amp;amp;TableName[StatusChangeDate]&amp;gt;=_firstdate
            &amp;amp;&amp;amp;TableName[PreviousChangeDate]&amp;lt;=_firstdate
    ),
    TableName[OldStatus]
)
VAR _value2 =
MAXX(
    TOPN(
        1,
        FILTER(
            TableName,
            TableName[CustomerID]=_customer
        ),
        TableName[StatusChangeDate]
    ),
    TableName[NewStatus]
)
RETURN
IF( _value1&amp;lt;&amp;gt;BLANK(), _value1,  _value2 )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 08:36:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-customer-status-for-a-given-date/m-p/3062130#M105856</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-02-05T08:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Finding customer status for a given date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-customer-status-for-a-given-date/m-p/3062140#M105857</link>
      <description>&lt;P&gt;Perfect thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 08:59:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-customer-status-for-a-given-date/m-p/3062140#M105857</guid>
      <dc:creator>akfir</dc:creator>
      <dc:date>2023-02-05T08:59:57Z</dc:date>
    </item>
  </channel>
</rss>

