<?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: How to count distinct after period in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-distinct-after-period/m-p/1510286#M29336</link>
    <description>&lt;P&gt;Here's another formula that should return the same as my previous one that uses SUMX&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;[# Active Customers] =
// It'll return the number
// of customers active
// according to your condition
// regardless of the time slice
// selected. Time should be
// connected on Date(!) to
// 'Customer Status'[JoinedDate]
// via a 1-to-many (one-way filtering).
var __minDate = min( Time[Date] )
var __output =
    CALCULATE(
        COUNTROWS( 'Customer Status'[CustomerID] ),
        KEEPFILTERS(
            'Customer Status'[JoinedDate] &amp;lt; __minDate
        )
    )
return
    // This time, if you want to return BLANKS as 0's,
    // just use __output + 0 instead of just __output.
    __output&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 23 Nov 2020 08:35:48 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-11-23T08:35:48Z</dc:date>
    <item>
      <title>How to count distinct after period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-distinct-after-period/m-p/1504170#M29127</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I Have a table in which customer information is saved.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="2"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;CustomerID&lt;/TD&gt;&lt;TD&gt;CustomerName&lt;/TD&gt;&lt;TD&gt;JoinedDate&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Alexender&lt;/TD&gt;&lt;TD&gt;2017-08-10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;David&lt;/TD&gt;&lt;TD&gt;2018-02-14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;Didier&lt;/TD&gt;&lt;TD&gt;2016-01-14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;Laurent&lt;/TD&gt;&lt;TD&gt;2019-03-02&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;Giulia&lt;/TD&gt;&lt;TD&gt;2017-01-01&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Boss has asked me to create a drill down report where in he wants all active customer count.&lt;/P&gt;&lt;P&gt;1st condition. suppose a customer is joined in year 2017 then for every year after 2017 the count should be as 1. 2nd condition. suppose a customer is joined in month 2018-Feb then for every month after 2018-Feb the count should be as 1.&lt;/P&gt;&lt;P&gt;same goes with "Day" drilldown as well.&lt;/P&gt;&lt;P&gt;I created a measure where in I have written below code but that didn't work. I have also created a calculated column for year and created a non active relationship between both tables.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CALCULATE( 
    DISTINCTCOUNT('Customer Status'[CustomerID]), 
    USERELATIONSHIP('Time'[Year],'Customer Status'[Customer Status Year]) 
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is working for year but for month it is showing same count for all month.&lt;/P&gt;&lt;P&gt;Requesting your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 08:12:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-distinct-after-period/m-p/1504170#M29127</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-19T08:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to count distinct after period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-distinct-after-period/m-p/1504207#M29130</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp; this might work if only the date table is filterling the visual&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;Distinct_Count:=VAR _MaxDate=MAX('Calendar'[Date]) RETURN CALCULATE(DISTINCTCOUNT(CustomerStatus[CustomerID]),'Calendar'[Date]&amp;lt;=_MaxDate)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 19 Nov 2020 08:27:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-distinct-after-period/m-p/1504207#M29130</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2020-11-19T08:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to count distinct after period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-distinct-after-period/m-p/1504223#M29131</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , Create a date table, Create only inactive join with joining date &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Current Customer = CALCULATE(COUNTx(FILTER('Customer Status','Customer Status'[Joined Date]&amp;lt;=max('Date'[Date]) ),('Customer Status'[CustomerID])))&lt;/P&gt;
&lt;P&gt;Current Customer = CALCULATE(distinctcount('Customer Status'[CustomerID]), FILTER('Customer Status','Customer Status'[Joined Date]&amp;lt;=max('Date'[Date]) ))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if join is active &lt;BR /&gt;Current Customer = CALCULATE(COUNTx(FILTER('Customer Status','Customer Status'[Joined Date]&amp;lt;=max('Date'[Date]) ),('Customer Status'[CustomerID])),CROSSFILTER(Employee[Join Date Date],'Date'[Date],None))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;refer &lt;A href="https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 08:33:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-distinct-after-period/m-p/1504223#M29131</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-11-19T08:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to count distinct after period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-distinct-after-period/m-p/1510275#M29335</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;[# Active Customers] =
// It'll return the number
// of customers active
// according to your condition
// regardless of the time slice
// selected. Time should be
// connected on Date(!) to
// 'Customer Status'[JoinedDate]
// via a 1-to-many (one-way filtering).
var __minDate = min( Time[Date] )
var __output =
    SUMX(
        DISTINCT( 'Customer Status'[CustomerId] ),
        // If the selected period in Time
        // has all dates &amp;gt;= JoinedDate, then
        // return 1. Otherwise 0.
        CALCULATE(
            VAR __joinedDate =
                SELECTEDVALUE( 'Customer Status'[JoinedDate] )
            return
                __minDate &amp;gt; __joinedDate
        )
    )
return
    // If you want to return 0's as BLANKS,
    // just use IF( __output &amp;gt; 0, __output )
    // instead of just returning __output.
    __output&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2020 08:31:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-distinct-after-period/m-p/1510275#M29335</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-23T08:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to count distinct after period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-distinct-after-period/m-p/1510286#M29336</link>
      <description>&lt;P&gt;Here's another formula that should return the same as my previous one that uses SUMX&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;[# Active Customers] =
// It'll return the number
// of customers active
// according to your condition
// regardless of the time slice
// selected. Time should be
// connected on Date(!) to
// 'Customer Status'[JoinedDate]
// via a 1-to-many (one-way filtering).
var __minDate = min( Time[Date] )
var __output =
    CALCULATE(
        COUNTROWS( 'Customer Status'[CustomerID] ),
        KEEPFILTERS(
            'Customer Status'[JoinedDate] &amp;lt; __minDate
        )
    )
return
    // This time, if you want to return BLANKS as 0's,
    // just use __output + 0 instead of just __output.
    __output&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 23 Nov 2020 08:35:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-distinct-after-period/m-p/1510286#M29336</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-23T08:35:48Z</dc:date>
    </item>
  </channel>
</rss>

