<?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: Measure to show current, new, recovered and lost buyers of the current month and two months before in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3062514#M105910</link>
    <description>&lt;P&gt;Perfect solution, thank you very much!!&lt;/P&gt;</description>
    <pubDate>Sun, 05 Feb 2023 22:30:58 GMT</pubDate>
    <dc:creator>Laocsulak</dc:creator>
    <dc:date>2023-02-05T22:30:58Z</dc:date>
    <item>
      <title>Measure to show current, new, recovered and lost buyers of the current month and two months before</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3059001#M105613</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have created the next table to explain the measures I need to create:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to create the next 5 measures, where I mention the value that it would take if I would be filtering the month 11 (november)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Current buyers 5&lt;/STRONG&gt;.&amp;nbsp;Because there were 5 different buyers in the months november, october or september.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;New current buyers: 1&lt;/STRONG&gt;. Because there was only one new buyer in the months november, october and september: buyer 7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Previous buyers: 3&lt;/STRONG&gt;. Because there were 3 different buyers in the months august, july or june: buyers 4, 5 and 6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Recovered buyers: 3&lt;/STRONG&gt;. This express the buyers that bought in the months november, october or september, and they didn't buy in the months august, july or june, but they have bought in some previous quarter. These are the buyers 1, 2 and 3 who bought in the months may, april or march.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Lost buyers: 2&lt;/STRONG&gt;. This express the buyers that bought in august, july or june, but not in november, october or september. These are the buyers 5 and 6 that bought in quarter august, july or june but not in november, october or september.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created this model where I could create the&lt;SPAN&gt; &lt;STRONG&gt;Current buyers&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;and the &lt;STRONG&gt;New current buyers&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;measures, but not the last three:&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/drive/folders/1A1lQk9UhC25q1rBgD-dIo1kdEi1FfDbL?usp=sharing" target="_blank" rel="nofollow noopener noreferrer"&gt;https://drive.google.com/drive/folders/1A1lQk9UhC25q1rBgD-dIo1kdEi1FfDbL?usp=sharing&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 21:25:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3059001#M105613</guid>
      <dc:creator>Laocsulak</dc:creator>
      <dc:date>2023-02-02T21:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to show current, new, recovered and lost buyers of the current month and two months before</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3059246#M105626</link>
      <description>&lt;P&gt;hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="477226" data-lia-user-login="Laocsulak" class="lia-mention lia-mention-user"&gt;Laocsulak&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a measure could not return a list/table, how are you going to showcase the expected measure/list? You wanna show the list or sum a value for the listed payers?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 01:36:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3059246#M105626</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-02-03T01:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to show current, new, recovered and lost buyers of the current month and two months before</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3059361#M105636</link>
      <description>&lt;P&gt;Hi Freeman, I want to count the number of buyers for every definition in a card. In the model uploaded, I was able to calculate the first 2 measures (current buyers and new current buyers), but not the last three.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 02:29:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3059361#M105636</guid>
      <dc:creator>Laocsulak</dc:creator>
      <dc:date>2023-02-03T02:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to show current, new, recovered and lost buyers of the current month and two months before</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3059459#M105645</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="477226" data-lia-user-login="Laocsulak" class="lia-mention lia-mention-user"&gt;Laocsulak&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you would need to add column like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;YYMM = FORMAT([date], "YYYYMM")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then write 5 measures like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Current3MBuyer =
VAR _month = SELECTEDVALUE(TableName[YYMM])
RETURN
COUNTROWS(
    CALCULATETABLE(
        VALUES(TableName[payer_id]),
        TableName[YYMM] IN {_month, _month-1, _month-2}
    )
)

New3MBuyer =
VAR _month = SELECTEDVALUE(TableName[YYMM])
RETURN
COUNTROWS(
    EXCEPT(
        CALCULATETABLE(
            VALUES(TableName[payer_id]),
            TableName[YYMM] IN {_month, _month-1, _month-2}
        ),
        CALCULATETABLE(
            VALUES(TableName[payer_id]),
            TableName[YYMM] &amp;lt; _month - 3
        )
    )
)

PreviousBuyer =
VAR _month = SELECTEDVALUE(TableName[YYMM])
RETURN
COUNTROWS(
    CALCULATETABLE(
        VALUES(TableName[payer_id]),
        TableName[YYMM] IN {_month-3, _month-4, _month-5}
    )
)

RecoveredBuyer =
VAR _month = SELECTEDVALUE(TableName[YYMM])
RETURN
COUNTROWS(
    EXCEPT(    
        INTERSECT(
            CALCULATETABLE(
                VALUES(TableName[payer_id]),
                TableName[YYMM] IN {_month, _month-1, _month-2}
            ),
            CALCULATETABLE(
                VALUES(TableName[payer_id]),
                TableName[YYMM] IN {_month-6, _month-7, _month-8}
            )
        ),
        CALCULATETABLE(
            VALUES(TableName[payer_id]),
            TableName[YYMM] IN {_month-3, _month-4, _month-5}
        )
    )
)

LostBuyers =
VAR _month = SELECTEDVALUE(TableName[YYMM])
RETURN
COUNTROWS(
    EXCEPT(    
        CALCULATETABLE(
            VALUES(TableName[payer_id]),
            TableName[YYMM] IN {_month-3, _month-4, _month-5}
        ),
        CALCULATETABLE(
            VALUES(TableName[payer_id]),
            TableName[YYMM] IN {_month, _month-1, _month-2}
        )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it worked like:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 03:24:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3059459#M105645</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-02-03T03:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to show current, new, recovered and lost buyers of the current month and two months before</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3060664#M105743</link>
      <description>&lt;P&gt;Thanks for the answer! It works quite well, but it fails when it compares to a different year because for example when filtering month = 202301, it compares to 202300 and 202299 which is not correct. Do you know how could I fix that? Besides, I would like to know something related to your first comment, if there's any way in which I can see the list of buyers that meet every requierement, for example a table that shows who are those 2 lost buyers.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 15:50:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3060664#M105743</guid>
      <dc:creator>Laocsulak</dc:creator>
      <dc:date>2023-02-03T15:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to show current, new, recovered and lost buyers of the current month and two months before</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3062031#M105842</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="477226" data-lia-user-login="Laocsulak" class="lia-mention lia-mention-user"&gt;Laocsulak&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1)&amp;nbsp;indeed corss years could be an issue. This shall work:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Current3MBuyer2 = 
VAR _yymm = SELECTEDVALUE(TableName[YYMM])
VAR _date1 = DATE(LEFT(_yymm, 4), RIGHT(_yymm, 2),1)
VAR _uplimit = EOMONTH(_date1, 0) 
VAR _lowlimit = EOMONTH(_date1, -3)+1
VAR Result = 
COUNTROWS(
    CALCULATETABLE(
        VALUES(TableName[payer_id]),
        TableName[date] &amp;gt;= _lowlimit,
        TableName[date] &amp;lt;= _uplimit,
        ALL(TableName[YYMM])
    )
)
RETURN Result&lt;/LI-CODE&gt;&lt;P&gt;others are very similar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In cases like this, it would be good to utilize Time Intelligence functions like DATEADD and DATESBETWEEN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2)&amp;nbsp;To see the list, try to write a measure like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Current3MBuyerList = 
VAR _yymm = SELECTEDVALUE(TableName[YYMM])
VAR _date1 = DATE(LEFT(_yymm, 4), RIGHT(_yymm, 2),1)
VAR _uplimit = EOMONTH(_date1, 0) 
VAR _lowlimit = EOMONTH(_date1, -3)+1
VAR Result = 
CONCATENATEX(
    CALCULATETABLE(
        VALUES(TableName[payer_id]),
        TableName[date] &amp;gt;= _lowlimit,
        TableName[date] &amp;lt;= _uplimit,
        ALL(TableName[YYMM])
    ),
    TableName[payer_id],
    ", "
)
RETURN Result&lt;/LI-CODE&gt;&lt;P&gt;others are very similar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it 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 03:55:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3062031#M105842</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-02-05T03:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to show current, new, recovered and lost buyers of the current month and two months before</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3062514#M105910</link>
      <description>&lt;P&gt;Perfect solution, thank you very much!!&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 22:30:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3062514#M105910</guid>
      <dc:creator>Laocsulak</dc:creator>
      <dc:date>2023-02-05T22:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to show current, new, recovered and lost buyers of the current month and two months before</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3113933#M110168</link>
      <description>&lt;P&gt;What if I prefer to view the customer names rather than the total number of customers? Please suggest the formula for this.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 13:28:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3113933#M110168</guid>
      <dc:creator>Dipakb</dc:creator>
      <dc:date>2023-03-06T13:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to show current, new, recovered and lost buyers of the current month and two months before</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3114239#M110194</link>
      <description>&lt;P&gt;hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="524796" data-lia-user-login="Dipakb" class="lia-mention lia-mention-user"&gt;Dipakb&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CONCATENATEX the list, whick is showcased in the last measure above.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 15:06:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-show-current-new-recovered-and-lost-buyers-of-the/m-p/3114239#M110194</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-03-06T15:06:05Z</dc:date>
    </item>
  </channel>
</rss>

