<?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 Measure to display returning customers in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-display-returning-customers/m-p/730140#M1729</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a very simple model;&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;P&gt;I want to calculate the distinct number of customers that did a sale in the past, but not in the last 180 days.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see in the following table, customer with id 1 does a second sale on 2019-07-02 and therefore it is the only "returning" customer in my data set;&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;P&gt;The result I want to achieve is;&lt;/P&gt;&lt;P&gt;2019-07-02 | 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the result, 1 is not the id of the customer, but it means there is only 1 returning customer on this date, which did a sale on this date, does not have a sale in the last 180 days from 2019-07-02, but does have a sale older than 180 days from 2019-07-02.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following measure is not producing any result;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the mistake in my measure?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance!&lt;/P&gt;</description>
    <pubDate>Tue, 02 Jul 2019 20:35:31 GMT</pubDate>
    <dc:creator>avanderschilden</dc:creator>
    <dc:date>2019-07-02T20:35:31Z</dc:date>
    <item>
      <title>Measure to display returning customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-display-returning-customers/m-p/730140#M1729</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a very simple model;&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;P&gt;I want to calculate the distinct number of customers that did a sale in the past, but not in the last 180 days.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see in the following table, customer with id 1 does a second sale on 2019-07-02 and therefore it is the only "returning" customer in my data set;&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;P&gt;The result I want to achieve is;&lt;/P&gt;&lt;P&gt;2019-07-02 | 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the result, 1 is not the id of the customer, but it means there is only 1 returning customer on this date, which did a sale on this date, does not have a sale in the last 180 days from 2019-07-02, but does have a sale older than 180 days from 2019-07-02.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following measure is not producing any result;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the mistake in my measure?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 20:35:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-display-returning-customers/m-p/730140#M1729</guid>
      <dc:creator>avanderschilden</dc:creator>
      <dc:date>2019-07-02T20:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to display returning customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-display-returning-customers/m-p/730158#M1731</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="41" data-lia-user-login="marcorusso" class="lia-mention lia-mention-user"&gt;marcorusso&lt;/a&gt;&amp;nbsp; wrote a quick measure for something like this:&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/New-and-Returning-Customers/m-p/168297" target="_blank"&gt;https://community.powerbi.com/t5/Quick-Measures-Gallery/New-and-Returning-Customers/m-p/168297&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 20:53:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-display-returning-customers/m-p/730158#M1731</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2019-07-02T20:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to display returning customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-display-returning-customers/m-p/730165#M1734</link>
      <description>&lt;P&gt;Thanks! I've seen this before but unfortunately it does not solve my problem. In Marco's example, a returning customer has an easier definition than in my example. My measure contains a mistake in one of the filter arguments which is the reason it does not produce the result I want.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 20:59:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-display-returning-customers/m-p/730165#M1734</guid>
      <dc:creator>avanderschilden</dc:creator>
      <dc:date>2019-07-02T20:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to display returning customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-display-returning-customers/m-p/730205#M1737</link>
      <description>Can you copy the code as a text instead of as a bitmap? It would be simpler to edit showing you possible improvements. There are two issues:&lt;BR /&gt;- calculation: you filter Sales[Date_ID] instead of Date[Date]&lt;BR /&gt;- performance: you have a very slow implementation of the calculation</description>
      <pubDate>Tue, 02 Jul 2019 22:35:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-display-returning-customers/m-p/730205#M1737</guid>
      <dc:creator>marcorusso</dc:creator>
      <dc:date>2019-07-02T22:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to display returning customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-display-returning-customers/m-p/731564#M1781</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="41" data-lia-user-login="marcorusso" class="lia-mention lia-mention-user"&gt;marcorusso&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I ended up with the following measure that produces the result I was looking for. As you mentioned on the sqlbi forum, this measure can be improved performance wise, so I will read the article you send me to see if I can implement the suggested performance improvements.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;U&gt;Reactivated Customers = &lt;/U&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;VAR CurrentUsers = &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;VALUES(Sales[customer_id])&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;VAR UsersLast180Days = &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;CALCULATETABLE(&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;VALUES(Sales[customer_id]),&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;FILTER (&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;ALL ( 'Dates' ),&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;Dates[Date] &amp;gt; MIN( Dates[Date] ) -180 &amp;amp;&amp;amp; Dates[Date] &amp;lt; MIN( Dates[Date] ) -1))&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;VAR UserBefore180Days = &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;CALCULATETABLE(&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;VALUES(Sales[customer_id]),&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;FILTER(ALL(Dates),Dates[Date]&amp;lt;MIN(Dates[Date])-180))&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;CALCULATE(&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;DISTINCTCOUNT(Sales[customer_id]),&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;FILTER (&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;ALL ( Sales[customer_id] ),&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;Sales[customer_id] IN CurrentUsers&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;&amp;amp;&amp;amp; Sales[customer_id] in UserBefore180Days&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;&amp;amp;&amp;amp; NOT Sales[customer_id] IN UsersLast180Days))&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 04 Jul 2019 07:18:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-display-returning-customers/m-p/731564#M1781</guid>
      <dc:creator>avanderschilden</dc:creator>
      <dc:date>2019-07-04T07:18:26Z</dc:date>
    </item>
  </channel>
</rss>

