<?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: calculating churn in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3990645#M154775</link>
    <description>&lt;P&gt;I changed the data to the dates from the date table, still getting an errror with [Date Lost customer] - I dint know where I should get it from&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# Lost Customers = 
VAR LastDateLost =
    CALCULATE (
        MAX ( 'Dim_Date'[Date] ),
        ALLSELECTED ( 'Dim_Date'[Date] )
    )
VAR CustomersWithLostDate =
    CALCULATETABLE (                        -- Prepares a table that 
        ADDCOLUMNS (                        -- for each customer contains 
            VALUES ( 'nh churned'[client_ID] ),  -- the date when they are considered lost 
            "@LostCustomerDate", [Date Lost Customer]
        ),
        ALLEXCEPT ( 'nh churned', 'nh churned'[client_ID] ),
        'Dim_Date'[Date] &amp;lt;= LastDateLost
    )
VAR LostCustomers =
    FILTER (                              
        CustomersWithLostDate,          -- Filters the customers
        [@LostCustomerDate]             -- whose lost customer date
            IN VALUES ( 'Dim_Date'[Date] )  -- fall within the current period
    )
VAR Result =
    COUNTROWS ( LostCustomers )         -- The count of the lost customers does not
                                        -- use the Sales table (no sales in the period)
RETURN
    Result&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 13 Jun 2024 08:49:55 GMT</pubDate>
    <dc:creator>mazwro</dc:creator>
    <dc:date>2024-06-13T08:49:55Z</dc:date>
    <item>
      <title>calculating churn</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3989484#M154671</link>
      <description>&lt;P&gt;Hi, I have a simple table as follows in screenshot:&lt;/P&gt;&lt;P&gt;I want to be able to create a flag to tell if a client is churned - e.g. have seen them purchased in the last 12 months, and I have not idea how to even start it. This I want to use to sum per month&amp;nbsp; the nr of customers who churned&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help, I am out of ideas.&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>Wed, 12 Jun 2024 19:25:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3989484#M154671</guid>
      <dc:creator>mazwro</dc:creator>
      <dc:date>2024-06-12T19:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: calculating churn</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3989561#M154679</link>
      <description>&lt;P&gt;This is how you do it&amp;nbsp;&lt;A href="https://www.daxpatterns.com/new-and-returning-customers/" target="_blank"&gt;https://www.daxpatterns.com/new-and-returning-customers/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 20:49:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3989561#M154679</guid>
      <dc:creator>MattAllington</dc:creator>
      <dc:date>2024-06-12T20:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: calculating churn</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3990116#M154739</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="702004" data-lia-user-login="mazwro" class="lia-mention lia-mention-user"&gt;mazwro&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the reply from MattAllington&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a calculated column that considers a customer churned if they have not made a purchase within the past 12 months of the maximum date in the data set.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;IsChurned =
var PY = CALCULATE(
MAX('Table'[order_YM]),
DATESINPERIOD(
'Table'[OrderDate],
MAX('Table'[OrderDate]),
-12,MONTH)
)
RETURN
IF(PY = BLANK(),"Churned", "Active")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a measure to calculate the number of churned customers:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Count =
CALCULATE(
COUNTROWS('Table'),
'Table'[IsChurned] = "Churned",
ALLEXCEPT('Table', 'Table'[order_YM])
)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the problem is not solved successfully,&amp;nbsp;I would be grateful if you could provide me with the pbix file or sample data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remember to remove sensitive data and do not log in to your account in Power BI Desktop when uploading the pbix file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have any other questions please feel free to contact me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The pbix file is attached.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 03:59:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3990116#M154739</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-13T03:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: calculating churn</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3990464#M154758</link>
      <description>&lt;P&gt;thanks &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="217" data-lia-user-login="MattAllington" class="lia-mention lia-mention-user"&gt;MattAllington&lt;/a&gt; , I am having trouble with this article - I made a script like the following, but i dont know where to take [Date Lost Customer]:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# Lost Customers = 
VAR LastDateLost =
    CALCULATE (
        MAX ( 'nh churned'[OrderDate].[Date] ),
        ALLSELECTED ( 'nh churned'[OrderDate].[Date] )
    )
VAR CustomersWithLostDate =
    CALCULATETABLE (                        -- Prepares a table that 
        ADDCOLUMNS (                        -- for each customer contains 
            VALUES ( 'nh churned'[client_ID] ),  -- the date when they are considered lost 
            "@LostCustomerDate", [Date Lost Customer]
        ),
        ALLEXCEPT ( 'nh churned', 'nh churned'[client_ID] ),
        'nh churned'[OrderDate].[Date] &amp;lt;= LastDateLost
    )
VAR LostCustomers =
    FILTER (                              
        CustomersWithLostDate,          -- Filters the customers
        [@LostCustomerDate]             -- whose lost customer date
            IN VALUES ( 'nh churned'[OrderDate].[Date] )  -- fall within the current period
    )
VAR Result =
    COUNTROWS ( LostCustomers )         -- The count of the lost customers does not
                                        -- use the Sales table (no sales in the period)
RETURN
    Result&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 13 Jun 2024 07:32:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3990464#M154758</guid>
      <dc:creator>mazwro</dc:creator>
      <dc:date>2024-06-13T07:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: calculating churn</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3990471#M154760</link>
      <description>&lt;P&gt;Thanks Anonymous&lt;/a&gt;&amp;nbsp; Yang, this looks like something I can handle, but does it calculate static churn for last 12 months only, or will it work too if I add month split and calculate number of churned per month?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 07:34:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3990471#M154760</guid>
      <dc:creator>mazwro</dc:creator>
      <dc:date>2024-06-13T07:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: calculating churn</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3990518#M154762</link>
      <description>&lt;P&gt;If you are going to follow the pattern, you need to do it exactly as shown. It looks like from your formulas that you don't have a calendar table. It's not going to work without that.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I can tell you that I copied the table structure and formulas, and it worked for me.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 07:53:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3990518#M154762</guid>
      <dc:creator>MattAllington</dc:creator>
      <dc:date>2024-06-13T07:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: calculating churn</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3990645#M154775</link>
      <description>&lt;P&gt;I changed the data to the dates from the date table, still getting an errror with [Date Lost customer] - I dint know where I should get it from&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# Lost Customers = 
VAR LastDateLost =
    CALCULATE (
        MAX ( 'Dim_Date'[Date] ),
        ALLSELECTED ( 'Dim_Date'[Date] )
    )
VAR CustomersWithLostDate =
    CALCULATETABLE (                        -- Prepares a table that 
        ADDCOLUMNS (                        -- for each customer contains 
            VALUES ( 'nh churned'[client_ID] ),  -- the date when they are considered lost 
            "@LostCustomerDate", [Date Lost Customer]
        ),
        ALLEXCEPT ( 'nh churned', 'nh churned'[client_ID] ),
        'Dim_Date'[Date] &amp;lt;= LastDateLost
    )
VAR LostCustomers =
    FILTER (                              
        CustomersWithLostDate,          -- Filters the customers
        [@LostCustomerDate]             -- whose lost customer date
            IN VALUES ( 'Dim_Date'[Date] )  -- fall within the current period
    )
VAR Result =
    COUNTROWS ( LostCustomers )         -- The count of the lost customers does not
                                        -- use the Sales table (no sales in the period)
RETURN
    Result&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 13 Jun 2024 08:49:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3990645#M154775</guid>
      <dc:creator>mazwro</dc:creator>
      <dc:date>2024-06-13T08:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: calculating churn</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3990673#M154777</link>
      <description>&lt;P&gt;Debugging DAX is a structured process.&amp;nbsp;&lt;BR /&gt;1. Set up a matrix and add some relevant data, maybe year and month&lt;/P&gt;&lt;P&gt;2. Add the measures that seem to work and make sure they look correct&lt;/P&gt;&lt;P&gt;3. Add the measure that doesn't work. Read the error message; it's the best insight into what is happening.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 08:57:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3990673#M154777</guid>
      <dc:creator>MattAllington</dc:creator>
      <dc:date>2024-06-13T08:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: calculating churn</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3992058#M154930</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="702004" data-lia-user-login="mazwro" class="lia-mention lia-mention-user"&gt;mazwro&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the reply from MattAllington&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This formula returns the churn rate for the last 12 months for the maximum date in your table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have any other questions please feel free to contact me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2024 01:18:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculating-churn/m-p/3992058#M154930</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-14T01:18:32Z</dc:date>
    </item>
  </channel>
</rss>

