<?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: Count of new cases in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-new-cases/m-p/2886973#M93609</link>
    <description>&lt;P&gt;hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="466338" data-lia-user-login="Sonya_Zam" class="lia-mention lia-mention-user"&gt;Sonya_Zam&lt;/a&gt;&amp;nbsp;im still not sure i i understood correctly,&lt;BR /&gt;are you saying that you need to count the customers that have been inactive for past 5 years? if so please follow along:&lt;BR /&gt;create new columns:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Last Seen = CALCULATE(MAX(Table1[ContactDate]),ALLEXCEPT(Table1,Table1[ClientD]))
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and for 5 years :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;More than 5 years? = IF(Table1[Last Seen] &amp;lt; ((TODAY()) - 365* 5),"True","False")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you will have something like:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then create a measure :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Count of = CALCULATE(DISTINCTCOUNT(Table1[ClientD]),Table1[More than 5 years?] = "True")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 05 Nov 2022 12:09:26 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-11-05T12:09:26Z</dc:date>
    <item>
      <title>Count of new cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-new-cases/m-p/2882889#M93365</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently have over ten years of data, and I am interested in counting the number of&amp;nbsp;&lt;SPAN&gt;new clients &amp;nbsp;who have not been seen in the 5 years preceding the first contact with a service during specific period. For example in 2021, there were &amp;nbsp;200 new consumers that utilised the service and won't seen over the last five years since their first contact. We currently have date at first contact, date the last contact and client ID.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help how to write the dax for this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 12:50:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-new-cases/m-p/2882889#M93365</guid>
      <dc:creator>Sonya_Zam</dc:creator>
      <dc:date>2022-11-03T12:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: Count of new cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-new-cases/m-p/2882947#M93373</link>
      <description>&lt;P&gt;hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="466338" data-lia-user-login="Sonya_Zam" class="lia-mention lia-mention-user"&gt;Sonya_Zam&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;if you could please provide with sample data&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 13:10:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-new-cases/m-p/2882947#M93373</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-03T13:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Count of new cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-new-cases/m-p/2884738#M93482</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="466338" data-lia-user-login="Sonya_Zam" class="lia-mention lia-mention-user"&gt;Sonya_Zam&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I created some data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Here are the steps you can follow：&lt;/P&gt;
&lt;P&gt;1. Create calculated table.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table 2 =
CALENDAR(DATE(2020,1,1),DATE(2022,12,31))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;2. Create measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
var _date=SELECTEDVALUE('Table 2'[Date])
var _last5date=DATE(YEAR(_date)-5,MONTH(_date),DAY(_date))
var _dateinterval=
SELECTCOLUMNS(FILTER(ALL('Table 2'),[Date]&amp;gt;=_last5date&amp;amp;&amp;amp;[Date]&amp;lt;=_date),"date1",[Date])
return
CALCULATE(DISTINCTCOUNT('Table'[client ID]),FILTER(ALL('Table'),
NOT( 'Table'[date at first contact] ) in _dateinterval))&lt;/LI-CODE&gt;
&lt;P&gt;3. Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If it doesn't meet your expectations, Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 06:53:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-new-cases/m-p/2884738#M93482</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-04T06:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: Count of new cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-new-cases/m-p/2886956#M93607</link>
      <description>&lt;P&gt;Below is a sample of the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to get the number of new clients that is defined as clients who has not been seen in the 5 years preceding the first service contact during the reference period.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, in 2021 there were two new clients A001 and E001 (within five years). &lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;ClientD&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;ContactDate&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;A001&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;01/11/2010&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;A001&lt;/P&g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P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;G001&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;…… (missing)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;C001&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;02/06/2021&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sat, 05 Nov 2022 11:42:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-new-cases/m-p/2886956#M93607</guid>
      <dc:creator>Sonya_Zam</dc:creator>
      <dc:date>2022-11-05T11:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: Count of new cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-new-cases/m-p/2886959#M93608</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;Please see above - I have provided a sample of the data. Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Nov 2022 11:44:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-new-cases/m-p/2886959#M93608</guid>
      <dc:creator>Sonya_Zam</dc:creator>
      <dc:date>2022-11-05T11:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: Count of new cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-new-cases/m-p/2886973#M93609</link>
      <description>&lt;P&gt;hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="466338" data-lia-user-login="Sonya_Zam" class="lia-mention lia-mention-user"&gt;Sonya_Zam&lt;/a&gt;&amp;nbsp;im still not sure i i understood correctly,&lt;BR /&gt;are you saying that you need to count the customers that have been inactive for past 5 years? if so please follow along:&lt;BR /&gt;create new columns:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Last Seen = CALCULATE(MAX(Table1[ContactDate]),ALLEXCEPT(Table1,Table1[ClientD]))
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and for 5 years :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;More than 5 years? = IF(Table1[Last Seen] &amp;lt; ((TODAY()) - 365* 5),"True","False")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you will have something like:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then create a measure :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Count of = CALCULATE(DISTINCTCOUNT(Table1[ClientD]),Table1[More than 5 years?] = "True")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Nov 2022 12:09:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-new-cases/m-p/2886973#M93609</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-05T12:09:26Z</dc:date>
    </item>
  </channel>
</rss>

