<?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: Calculate active customers whose last sale was in last 12 months in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-active-customers-whose-last-sale-was-in-last-12-months/m-p/2568612#M73264</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Solved it in the end, was simply this!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;# Active Customers = 
VAR EndDate = MAX('Calendar'[Date])
VAR StartDate =EDATE(EndDate,-12)
VAR Result = 
CALCULATE(
[# Customers],DATESBETWEEN(Calendar[date],StartDate,EndDate)
)

RETURN
    IF (Result = BLANK(), 0, Result)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jun 2022 09:03:02 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-06-09T09:03:02Z</dc:date>
    <item>
      <title>Calculate active customers whose last sale was in last 12 months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-active-customers-whose-last-sale-was-in-last-12-months/m-p/2565884#M73109</link>
      <description>&lt;P&gt;Trying to work out number of active customers checking if their lapsed date has been reached. Lapsed date is when there is no order for customer in last 12 months&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;# Active Cust = 
VAR dt =
    CALCULATE (
        MAX ( 'Calendar'[Date] ),
        ALLSELECTED ( 'Calendar'[Date] )
    )

VAR ActiveCustomers =
    ADDCOLUMNS (                            
        VALUES ( Sales[Sell-to Customer No_] )
        ,"@LapsedDate", [CustomerLapsedDate] ) -- measure lasped date , last order date + 12 months

var __activeCusts =
COUNTROWS (
    DISTINCT (
            FILTER ( ActiveCustomers, [@LapsedDate] &amp;gt; dt)
        )
)
return  __activeCusts&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Desired Result with correct active customers, the total is actually correct as it stand 33 customers have not lasped. However I want this view at month level. So June should show 33&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2022 08:35:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-active-customers-whose-last-sale-was-in-last-12-months/m-p/2565884#M73109</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-08T08:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate active customers whose last sale was in last 12 months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-active-customers-whose-last-sale-was-in-last-12-months/m-p/2566873#M73160</link>
      <description>&lt;P&gt;Can i include anything extra to help arrive at a solution, new to psoting on the forum thanks?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2022 14:30:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-active-customers-whose-last-sale-was-in-last-12-months/m-p/2566873#M73160</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-08T14:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate active customers whose last sale was in last 12 months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-active-customers-whose-last-sale-was-in-last-12-months/m-p/2568612#M73264</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Solved it in the end, was simply this!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;# Active Customers = 
VAR EndDate = MAX('Calendar'[Date])
VAR StartDate =EDATE(EndDate,-12)
VAR Result = 
CALCULATE(
[# Customers],DATESBETWEEN(Calendar[date],StartDate,EndDate)
)

RETURN
    IF (Result = BLANK(), 0, Result)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2022 09:03:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-active-customers-whose-last-sale-was-in-last-12-months/m-p/2568612#M73264</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-09T09:03:02Z</dc:date>
    </item>
  </channel>
</rss>

