<?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: Measure to Determine if Customer is Active during selected date range AND sameperiodlastyear range in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Determine-if-Customer-is-Active-during-selected-date/m-p/4267594#M169196</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="770280" data-lia-user-login="karleek" class="lia-mention lia-mention-user"&gt;karleek&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Your requirement sounds relatively straightforward, and you can achieve the desired output by writing a DAX formula like the one below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;TotalOrdersIfInBothPeriods = 
VAR CustomersInSelectedRange = 
    CALCULATE(
        DISTINCTCOUNT('Sales transaction'[Customer code]),
        'Sales transaction'[Posting Date] &amp;gt;= MIN('Calendar'[Date]) &amp;amp;&amp;amp; 'Sales transaction'[Posting Date] &amp;lt;= MAX('Calendar'[Date])
    )

VAR CustomersInSamePeriodLastYear = 
    CALCULATE(
        DISTINCTCOUNT('Sales transaction'[Customer code]),
        SAMEPERIODLASTYEAR('Calendar'[Date])
    )

    VAR OrdersInSelectedRange = 
    CALCULATE(
        countrows('Sales transaction'),
        'Sales transaction'[Posting Date] &amp;gt;= MIN('Calendar'[Date]) &amp;amp;&amp;amp; 'Sales transaction'[Posting Date] &amp;lt;= MAX('Calendar'[Date])
    )

RETURN
IF(
    CustomersInSelectedRange &amp;gt; 0 &amp;amp;&amp;amp; CustomersInSamePeriodLastYear &amp;gt; 0,
    OrdersInSelectedRange,
    0
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I have taken order to be equivalent to sales, and used the dummy sales data. Please find attached an example pbix file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 02 Nov 2024 06:15:31 GMT</pubDate>
    <dc:creator>DataNinja777</dc:creator>
    <dc:date>2024-11-02T06:15:31Z</dc:date>
    <item>
      <title>Measure to Determine if Customer is Active during selected date range AND sameperiodlastyear range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Determine-if-Customer-is-Active-during-selected-date/m-p/4267362#M169182</link>
      <description>&lt;P&gt;I am needing to create a measure that achieve the following:&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. determine if customer (unique id) has orders during selected date range on slicer&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. determine if customer (unqiue id) has order during the sameperiodlastyear of the date range on slicer&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. If they answer to both of the above is YES, then calculate the total number of orders for date range in slicer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help on this would be much appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/362560" target="_blank" rel="noopener"&gt;@Ahmedx&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/148838" target="_blank" rel="noopener"&gt;@amitchandak&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/19851" target="_blank" rel="noopener"&gt;@Ashish_Mathur&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/15697" target="_blank" rel="noopener"&gt;@danextian&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/52518" target="_blank" rel="noopener"&gt;@Fowmy&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/313" target="_blank" rel="noopener"&gt;@Greg_Deckler&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/507" target="_blank" rel="noopener"&gt;@parry2k&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/678168" target="_blank" rel="noopener"&gt;@talespin&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/317289" target="_blank" rel="noopener"&gt;@tamerj1&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/343583" target="_self"&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="39298" data-lia-user-login="AlexisOlson" class="lia-mention lia-mention-user"&gt;AlexisOlson&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&amp;nbsp;&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 19:59:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Determine-if-Customer-is-Active-during-selected-date/m-p/4267362#M169182</guid>
      <dc:creator>karleek</dc:creator>
      <dc:date>2024-11-01T19:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to Determine if Customer is Active during selected date range AND sameperiodlastyear range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Determine-if-Customer-is-Active-during-selected-date/m-p/4267594#M169196</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="770280" data-lia-user-login="karleek" class="lia-mention lia-mention-user"&gt;karleek&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Your requirement sounds relatively straightforward, and you can achieve the desired output by writing a DAX formula like the one below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;TotalOrdersIfInBothPeriods = 
VAR CustomersInSelectedRange = 
    CALCULATE(
        DISTINCTCOUNT('Sales transaction'[Customer code]),
        'Sales transaction'[Posting Date] &amp;gt;= MIN('Calendar'[Date]) &amp;amp;&amp;amp; 'Sales transaction'[Posting Date] &amp;lt;= MAX('Calendar'[Date])
    )

VAR CustomersInSamePeriodLastYear = 
    CALCULATE(
        DISTINCTCOUNT('Sales transaction'[Customer code]),
        SAMEPERIODLASTYEAR('Calendar'[Date])
    )

    VAR OrdersInSelectedRange = 
    CALCULATE(
        countrows('Sales transaction'),
        'Sales transaction'[Posting Date] &amp;gt;= MIN('Calendar'[Date]) &amp;amp;&amp;amp; 'Sales transaction'[Posting Date] &amp;lt;= MAX('Calendar'[Date])
    )

RETURN
IF(
    CustomersInSelectedRange &amp;gt; 0 &amp;amp;&amp;amp; CustomersInSamePeriodLastYear &amp;gt; 0,
    OrdersInSelectedRange,
    0
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I have taken order to be equivalent to sales, and used the dummy sales data. Please find attached an example pbix file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Nov 2024 06:15:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Determine-if-Customer-is-Active-during-selected-date/m-p/4267594#M169196</guid>
      <dc:creator>DataNinja777</dc:creator>
      <dc:date>2024-11-02T06:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to Determine if Customer is Active during selected date range AND sameperiodlastyear range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Determine-if-Customer-is-Active-during-selected-date/m-p/4280491#M169876</link>
      <description>&lt;P&gt;This worked beautifully thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I need to create another measure that takes it a step further.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the selected range is 1/1/2024 - 10/31/2024 and the customer has active orderw within that time range and they also have orders within PART of the sameperiodlast year, orders only within 6/1/2023 - 10/31/2023, I want my total order measure to ONLY add in the orders for 2024 for 6/1/2024 - 10/31/2024 so that I can compared YoY order volume change for the same period. Does that make sense?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/362560" target="_blank" rel="noopener"&gt;@Ahmedx&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/148838" target="_blank" rel="noopener"&gt;@amitchandak&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/19851" target="_blank" rel="noopener"&gt;@Ashish_Mathur&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/15697" target="_blank" rel="noopener"&gt;@danextian&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/52518" target="_blank" rel="noopener"&gt;@Fowmy&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/313" target="_blank" rel="noopener"&gt;@Greg_Deckler&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/507" target="_blank" rel="noopener"&gt;@parry2k&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/678168" target="_blank" rel="noopener"&gt;@talespin&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/317289" target="_blank" rel="noopener"&gt;@tamerj1&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/343583" target="_self"&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/39298" target="_blank"&gt;@AlexisOlson&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/291628" target="_blank"&gt;@Jihwan_Kim&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/100342" target="_blank"&gt;@lbendlin&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/343583" target="_blank"&gt;@v-cgao-msft&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2024 16:20:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Determine-if-Customer-is-Active-during-selected-date/m-p/4280491#M169876</guid>
      <dc:creator>karleek</dc:creator>
      <dc:date>2024-11-18T16:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to Determine if Customer is Active during selected date range AND sameperiodlastyear range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Determine-if-Customer-is-Active-during-selected-date/m-p/4374490#M173691</link>
      <description>&lt;P&gt;I know it has been a while, but recirculating this data reporting project. While the above measure works, when I use it within a matrix the subtotal and there totals are inaccurate. I understand that is because the subtotals and totals are looking at the full data range and ignoring the filters within the rest of the measure, but how do I fix that? I really need the measure to provide an accurate subtotal and total within a matrix.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2025 22:55:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Determine-if-Customer-is-Active-during-selected-date/m-p/4374490#M173691</guid>
      <dc:creator>karleek</dc:creator>
      <dc:date>2025-01-21T22:55:57Z</dc:date>
    </item>
  </channel>
</rss>

