<?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: Problems with measuring purchases in period prior to date filter in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problems-with-measuring-purchases-in-period-prior-to-date-filter/m-p/3990329#M154751</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="758724" data-lia-user-login="KeeganM4" class="lia-mention lia-mention-user"&gt;KeeganM4&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;First of all, many thanks to&amp;nbsp;for your very quick and effective replies.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I can’t open the file link.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Based on my testing, please &lt;SPAN&gt;try the following methods:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1.Create the simple tables.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2.Create the new measure to calculate buyerID.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ReengagedBuyers = 
VAR MinSelectedDate = MIN('Date'[Date])
VAR StartDate = MinSelectedDate
VAR EndDate = MAX('Date'[Date])
VAR Prior90DaysStart = StartDate - 90

RETURN
    COUNTROWS(
        FILTER(
            VALUES('Invoice Table'[BuyerID]),
            CALCULATE(
                COUNTROWS('Invoice Table'),
                'Invoice Table'[InvoiceDate] &amp;gt;= StartDate &amp;amp;&amp;amp; 'Invoice Table'[InvoiceDate] &amp;lt;= EndDate,
                ALL('Invoice Table'[InvoiceDate])
            ) &amp;gt; 0 &amp;amp;&amp;amp; 
            CALCULATE(
                CALCULATE(
                COUNTROWS('Invoice Table'),
                'Invoice Table'[InvoiceDate] &amp;gt;= Prior90DaysStart &amp;amp;&amp;amp; 'Invoice Table'[InvoiceDate] &amp;lt; StartDate,
                ALL('Invoice Table'[InvoiceDate])
                )
            ) = 0
        )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;3.Drag the Date field into the slicer visual.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;4.Drag the measure into the card visual. The result is shown below.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Wisdom Wu&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jun 2024 06:32:48 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-06-13T06:32:48Z</dc:date>
    <item>
      <title>Problems with measuring purchases in period prior to date filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problems-with-measuring-purchases-in-period-prior-to-date-filter/m-p/3988949#M154598</link>
      <description>&lt;P&gt;I have an invoice table with columns invoiceID, buyerID, InvoiceDate and another standard Dates table&lt;BR /&gt;&lt;BR /&gt;I am trying to be able track buyer re-engagement by checking the 90 days previous to the start of my date filter. If a buyer has an invoice the filtered window, but had no invoices in the 90 days before the start of the date filter they should appear as reengaged.&lt;BR /&gt;&lt;BR /&gt;My problem is I am getting the same count of buyers as for my count of buyers within the filtered period, and when I modify my measure to check for the buyers only in the 90 days prior to the filter I get zero.&lt;BR /&gt;&lt;BR /&gt;My code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ReengagedBuyers = 
VAR MinSelectedDate = CALCULATE(MIN('Date'[Dates]), ALLSELECTED('Date'))
VAR StartDate = MinSelectedDate
VAR EndDate = CALCULATE(MAX('Date'[Dates]), ALLSELECTED('Date'))
VAR Prior90DaysStart = StartDate - 90

RETURN
    COUNTROWS(
        FILTER(
            VALUES(invoice[buyerid]),
            CALCULATE(
                COUNTROWS(invoice),
                invoice[Created Date] &amp;gt;= StartDate &amp;amp;&amp;amp; invoice[Created Date] &amp;lt;= EndDate,
                ALL(invoice[Created Date])
            ) &amp;gt; 0 &amp;amp;&amp;amp;
            CALCULATE(
                COUNTROWS(invoice),
                invoice[Created Date] &amp;gt;= Prior90DaysStart &amp;amp;&amp;amp; invoice[Created Date] &amp;lt; StartDate,
                ALL(invoice[Created Date])
            ) = 0
        )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Any help would be appreciated, thank you!&lt;BR /&gt;&lt;BR /&gt;Sample data here:&lt;BR /&gt;&lt;A href="https://drive.google.com/drive/folders/1VK0VJ0XtmnvBHeYKtc1YG5FDmtDIajU3?usp=sharing" target="_blank"&gt;https://drive.google.com/drive/folders/1VK0VJ0XtmnvBHeYKtc1YG5FDmtDIajU3?usp=sharing&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 03:10:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problems-with-measuring-purchases-in-period-prior-to-date-filter/m-p/3988949#M154598</guid>
      <dc:creator>KeeganM4</dc:creator>
      <dc:date>2024-06-13T03:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with measuring purchases in period prior to date filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problems-with-measuring-purchases-in-period-prior-to-date-filter/m-p/3989718#M154695</link>
      <description>&lt;P&gt;Please provide sample data that covers your issue or question &lt;STRONG&gt;completely&lt;/STRONG&gt;, in a &lt;STRONG&gt;usable&lt;/STRONG&gt; format (not as a screenshot).&lt;BR /&gt;&lt;BR /&gt;Do not include sensitive information or anything not related to the issue or question. &lt;BR /&gt;&lt;BR /&gt;If you are unsure how to upload data please refer to &lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;Want faster answers? &lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 00:12:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problems-with-measuring-purchases-in-period-prior-to-date-filter/m-p/3989718#M154695</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-06-13T00:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with measuring purchases in period prior to date filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problems-with-measuring-purchases-in-period-prior-to-date-filter/m-p/3990058#M154734</link>
      <description>&lt;P&gt;&lt;A href="https://drive.google.com/drive/folders/1VK0VJ0XtmnvBHeYKtc1YG5FDmtDIajU3?usp=sharing" target="_blank"&gt;https://drive.google.com/drive/folders/1VK0VJ0XtmnvBHeYKtc1YG5FDmtDIajU3?usp=sharing&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Here is a link to some sample data, thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 03:10:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problems-with-measuring-purchases-in-period-prior-to-date-filter/m-p/3990058#M154734</guid>
      <dc:creator>KeeganM4</dc:creator>
      <dc:date>2024-06-13T03:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with measuring purchases in period prior to date filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problems-with-measuring-purchases-in-period-prior-to-date-filter/m-p/3990329#M154751</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="758724" data-lia-user-login="KeeganM4" class="lia-mention lia-mention-user"&gt;KeeganM4&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;First of all, many thanks to&amp;nbsp;for your very quick and effective replies.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I can’t open the file link.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Based on my testing, please &lt;SPAN&gt;try the following methods:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1.Create the simple tables.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2.Create the new measure to calculate buyerID.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ReengagedBuyers = 
VAR MinSelectedDate = MIN('Date'[Date])
VAR StartDate = MinSelectedDate
VAR EndDate = MAX('Date'[Date])
VAR Prior90DaysStart = StartDate - 90

RETURN
    COUNTROWS(
        FILTER(
            VALUES('Invoice Table'[BuyerID]),
            CALCULATE(
                COUNTROWS('Invoice Table'),
                'Invoice Table'[InvoiceDate] &amp;gt;= StartDate &amp;amp;&amp;amp; 'Invoice Table'[InvoiceDate] &amp;lt;= EndDate,
                ALL('Invoice Table'[InvoiceDate])
            ) &amp;gt; 0 &amp;amp;&amp;amp; 
            CALCULATE(
                CALCULATE(
                COUNTROWS('Invoice Table'),
                'Invoice Table'[InvoiceDate] &amp;gt;= Prior90DaysStart &amp;amp;&amp;amp; 'Invoice Table'[InvoiceDate] &amp;lt; StartDate,
                ALL('Invoice Table'[InvoiceDate])
                )
            ) = 0
        )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;3.Drag the Date field into the slicer visual.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;4.Drag the measure into the card visual. The result is shown below.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Wisdom Wu&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 06:32:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problems-with-measuring-purchases-in-period-prior-to-date-filter/m-p/3990329#M154751</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-13T06:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with measuring purchases in period prior to date filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problems-with-measuring-purchases-in-period-prior-to-date-filter/m-p/3991248#M154813</link>
      <description>&lt;P&gt;Thanks for your reply, but I don't think this is solving.&lt;BR /&gt;&lt;BR /&gt;There is a relationship between my invoice dates and my Dates. In your sample file, I have added that relationship and another card to check for unique buyers in range, and I am still getting the same count for both, where I would expect reengaged buyers to only be a portion of the total buyers in period&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 13:46:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problems-with-measuring-purchases-in-period-prior-to-date-filter/m-p/3991248#M154813</guid>
      <dc:creator>KeeganM4</dc:creator>
      <dc:date>2024-06-13T13:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with measuring purchases in period prior to date filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problems-with-measuring-purchases-in-period-prior-to-date-filter/m-p/3991388#M154823</link>
      <description>&lt;P&gt;Update, I have solved the issue. My original metric works, but I needed to add CROSSFILTER to set the relationship of my invoice table with dates table to NONE so that the filter doesn't filter out all the dates prior to my range&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 14:34:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problems-with-measuring-purchases-in-period-prior-to-date-filter/m-p/3991388#M154823</guid>
      <dc:creator>KeeganM4</dc:creator>
      <dc:date>2024-06-13T14:34:40Z</dc:date>
    </item>
  </channel>
</rss>

