<?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: Identify new customers using date differences in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identify-new-customers-using-date-differences/m-p/3312371#M123873</link>
    <description>&lt;P&gt;This works great. Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="578180" data-lia-user-login="Martin_D" class="lia-mention lia-mention-user"&gt;Martin_D&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jul 2023 09:20:33 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-07-03T09:20:33Z</dc:date>
    <item>
      <title>Identify new customers using date differences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identify-new-customers-using-date-differences/m-p/3310482#M123749</link>
      <description>&lt;P&gt;I’m currently developing an arrears report based on the following table. I want to look at the new customers that went into arrears this week. So, I only want to include customer C this week (26/06/2023) because A and B was in arrears last week. How can I do this in a measure?&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Customer&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Date&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;A&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;26/06/2023&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;B&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;26/06/2023&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;C&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;26/06/2023&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;A&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;19/06/2023&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;B&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;19/06/2023&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I’m thinking of a measure using Dateadd.&lt;/P&gt;&lt;P&gt;New customers in arrears=&lt;/P&gt;&lt;P&gt;Var CurrentDate = selectedvalue (‘Table’[Date])&lt;/P&gt;&lt;P&gt;Return&lt;/P&gt;&lt;P&gt;Calculate(count(‘table’[Customer]), “check if each company has date = dateadd(CurrentDate, -7, Days)”)&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2023 15:19:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identify-new-customers-using-date-differences/m-p/3310482#M123749</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-30T15:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: Identify new customers using date differences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identify-new-customers-using-date-differences/m-p/3310538#M123750</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;From your sample data and description I assume the following constraints:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;You only want to compare with the directly previous week, not with all previous weeks&lt;/LI&gt;&lt;LI&gt;You have weekly data, every 7 days, so you only need to compare with exactly 7 days earlier, not with all dates in the previous week&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Then try the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Count of new customers = 
VAR _selectedWeek = MAX ( 'Table'[Date] )
VAR _previousWeek = _selectedWeek - 7
VAR _customersSelectedWeek =
    CALCULATETABLE (
        VALUES ( 'Table'[Customer] ),
        'Table'[Date] = _selectedWeek
    )
VAR _customersPreviousWeek =
    CALCULATETABLE (
        VALUES ( 'Table'[Customer] ),
        'Table'[Date] =_previousWeek
    )
VAR _newCustomers = EXCEPT ( _customersSelectedWeek, _customersPreviousWeek )
VAR _countOfNewCustomers = COUNTAX ( _newCustomers, [Customer] )
RETURN
_countOfNewCustomers&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-right"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-right"&gt;&lt;A title="GitHub" href="https://github.com/MartinBubenheimer" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt;&lt;A title="linkedin" href="https://www.linkedin.com/in/martin-bubenheimer-9ba99271/" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2023 16:11:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identify-new-customers-using-date-differences/m-p/3310538#M123750</guid>
      <dc:creator>Martin_D</dc:creator>
      <dc:date>2023-06-30T16:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Identify new customers using date differences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identify-new-customers-using-date-differences/m-p/3312371#M123873</link>
      <description>&lt;P&gt;This works great. Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="578180" data-lia-user-login="Martin_D" class="lia-mention lia-mention-user"&gt;Martin_D&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2023 09:20:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identify-new-customers-using-date-differences/m-p/3312371#M123873</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-07-03T09:20:33Z</dc:date>
    </item>
  </channel>
</rss>

