<?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 Count of unique customer ID within date range - custom column? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-unique-customer-ID-within-date-range-custom-column/m-p/2383180#M61663</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would love any advice to help me solve my problem statement.&amp;nbsp; As a relatively new person to Power BI I would love any advice you can provide.&amp;nbsp; I am looking to count on a record fort a call received today how many calls did that customer maki in the previous 7 days.&amp;nbsp; I have a dataset of calls over time, sample included below.&amp;nbsp; The unique customer ID is the phone number, the date range is the start date of the call minus 7 days.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I want to solve this with a custome column, but open to any advice.&amp;nbsp; I am unsure whther the fact that my start date column includes time could be causing me issues?&amp;nbsp; Idealy I would want a solution that can consider the time of call as the customer may call multiple times in one day.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the sample I have provided below, I have provided the results I would expect for the calls received on the 08/01/22 based on the data supplied 01/01/22 - 08/01/22.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for any support you can provide me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Start date / time&lt;/TD&gt;&lt;TD&gt;Phone number&lt;/TD&gt;&lt;TD&gt;How many calls in previous 7 days&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD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lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5/01/2022 9:00&lt;/TD&gt;&lt;TD&gt;45678&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5/01/2022 10:00&lt;/TD&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6/01/2022 10:00&lt;/TD&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7/01/2022 11:00&lt;/TD&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8/01/2022 8:00&lt;/TD&gt;&lt;TD&gt;98765&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8/01/2022 9:00&lt;/TD&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8/01/2022 10:00&lt;/TD&gt;&lt;TD&gt;45678&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8/01/2022 11:00&lt;/TD&gt;&lt;TD&gt;45678&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Wed, 09 Mar 2022 09:33:10 GMT</pubDate>
    <dc:creator>kate_wass</dc:creator>
    <dc:date>2022-03-09T09:33:10Z</dc:date>
    <item>
      <title>Count of unique customer ID within date range - custom column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-unique-customer-ID-within-date-range-custom-column/m-p/2383180#M61663</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would love any advice to help me solve my problem statement.&amp;nbsp; As a relatively new person to Power BI I would love any advice you can provide.&amp;nbsp; I am looking to count on a record fort a call received today how many calls did that customer maki in the previous 7 days.&amp;nbsp; I have a dataset of calls over time, sample included below.&amp;nbsp; The unique customer ID is the phone number, the date range is the start date of the call minus 7 days.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I want to solve this with a custome column, but open to any advice.&amp;nbsp; I am unsure whther the fact that my start date column includes time could be causing me issues?&amp;nbsp; Idealy I would want a solution that can consider the time of call as the customer may call multiple times in one day.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the sample I have provided below, I have provided the results I would expect for the calls received on the 08/01/22 based on the data supplied 01/01/22 - 08/01/22.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for any support you can provide me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Start date / time&lt;/TD&gt;&lt;TD&gt;Phone number&lt;/TD&gt;&lt;TD&gt;How many calls in previous 7 days&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/01/2022 8:00&lt;/TD&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/01/2022 9:00&lt;/TD&gt;&lt;TD&gt;45678&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/01/2022 10:00&lt;/TD&gt;&lt;TD&gt;12345&lt;/TD&gt;&l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;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7/01/2022 11:00&lt;/TD&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8/01/2022 8:00&lt;/TD&gt;&lt;TD&gt;98765&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8/01/2022 9:00&lt;/TD&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8/01/2022 10:00&lt;/TD&gt;&lt;TD&gt;45678&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8/01/2022 11:00&lt;/TD&gt;&lt;TD&gt;45678&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 09 Mar 2022 09:33:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-unique-customer-ID-within-date-range-custom-column/m-p/2383180#M61663</guid>
      <dc:creator>kate_wass</dc:creator>
      <dc:date>2022-03-09T09:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Count of unique customer ID within date range - custom column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-unique-customer-ID-within-date-range-custom-column/m-p/2383211#M61665</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I suggest having date column and time column separate.&lt;/P&gt;
&lt;P&gt;And please wite the below calculated column to create a new column.&lt;/P&gt;
&lt;P&gt;It will show the result for counting calls during previous seven days only for the dates that are after 8th Jan. 2022.&lt;/P&gt;
&lt;P&gt;Please also check the attached pbix file.&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;
&lt;LI-CODE lang="markup"&gt;Calls in previous 7 days CC =
VAR currentphonenumber = Data[Phone number]
VAR currentdate = Data[Start date]
VAR sevendaysago = currentdate - 7
RETURN
    IF (
        Data[Start date] &amp;gt;= DATE ( 2022, 1, 8 ),
        COUNTROWS (
            FILTER (
                Data,
                Data[Phone number] = currentphonenumber
                    &amp;amp;&amp;amp; Data[Start date] &amp;gt;= sevendaysago
                    &amp;amp;&amp;amp; Data[Start date] &amp;lt; currentdate
            )
        ) + 0
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 09:53:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-unique-customer-ID-within-date-range-custom-column/m-p/2383211#M61665</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-03-09T09:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Count of unique customer ID within date range - custom column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-unique-customer-ID-within-date-range-custom-column/m-p/2383224#M61669</link>
      <description>&lt;P&gt;This will calculate the number of calls in the previous 7 days&lt;/P&gt;&lt;PRE&gt;Num prev calls 7 days = &lt;BR /&gt;var currentPhone = 'Table'[Phone number]&lt;BR /&gt;var currentDate = 'Table'[Start date / time]&lt;BR /&gt;return COALESCE( CALCULATE( COUNTROWS('Table' ), REMOVEFILTERS(), 'Table'[Phone number] = currentPhone &lt;BR /&gt;&amp;amp;&amp;amp; 'Table'[Start date / time] &amp;lt; currentDate &amp;amp;&amp;amp; 'Table'[Start date / time] &amp;gt;= currentDate - 7 ), 0 )&lt;/PRE&gt;&lt;P&gt;Please note that this does take into account the time of the call, so the numbers returned are slightly different from your example. e.g. the last call for number 12345 occurs at 9am, so the first call on 1/1 at 8am is not included in the count as it falls outside the full 7 days.&lt;/P&gt;&lt;P&gt;If you want to include all calls which occurred upto 7 days ago, regardless of the time of the call, you could split your start date time column into separate date and time columns, or you could change the new column definition to just get the date part of currentDate - 7.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 10:01:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-unique-customer-ID-within-date-range-custom-column/m-p/2383224#M61669</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-03-09T10:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: Count of unique customer ID within date range - custom column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-unique-customer-ID-within-date-range-custom-column/m-p/2383396#M61679</link>
      <description>&lt;P&gt;Excel worksheet formula is way powerful to solve such a simple question,&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 11:20:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-unique-customer-ID-within-date-range-custom-column/m-p/2383396#M61679</guid>
      <dc:creator>CNENFRNL</dc:creator>
      <dc:date>2022-03-09T11:20:17Z</dc:date>
    </item>
  </channel>
</rss>

