<?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 Active records over time based on Criteria in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-records-over-time-based-on-Criteria/m-p/1051008#M14380</link>
    <description>&lt;P&gt;I have a services table (Fact) and a Service Type (Dimension) table. Each service has a cost, a start and end date, which is linked to a customer and a service type. I also have an active flag on the Services table where the service is currently active.&lt;BR /&gt;Each customer can have many active services at once.&lt;BR /&gt;&lt;BR /&gt;I've created a couple of calculations to show a count of customers with active services over time:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Number of active customers =&lt;/P&gt;&lt;P&gt;CALCULATE(&lt;BR /&gt;DISTINCTCOUNT('Services'[Person_ID])&lt;BR /&gt;,Filter('Services','Services'[START_DTTM]&amp;lt;=now())&lt;BR /&gt;,FILTER('Services','Services'[END_DTTM]&amp;gt;=now())&lt;/P&gt;&lt;P&gt;)&lt;BR /&gt;&lt;BR /&gt;and&amp;nbsp; which shows the active users with services of a specific type over $600&lt;/P&gt;&lt;P&gt;users with total Services $600+ =&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Calculate(&lt;BR /&gt;DISTINCTCOUNT('Services'[PERSON_ID]),&lt;BR /&gt;FILTER('Services','Services'[Active]=1),&lt;/P&gt;&lt;P&gt;Filter('Services',(&lt;BR /&gt;CALCULATE(sum('Services'[Cost]),&lt;BR /&gt;ALLEXCEPT('Services',&lt;BR /&gt;'Services'[PERSON_ID],&lt;BR /&gt;'Services'[Active],&lt;BR /&gt;'Service Type'[ServiceGroup]&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;BR /&gt;))&amp;gt;600&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Now, I want to combine the two. However, if I add the filter from the first calculation into the second, I need to add start date and end date into the ALLEXCEPT clause, however, this then only groups together services that start and end on the same day, which doesn't give me the desired result. Any help would be great. Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Apr 2020 13:48:24 GMT</pubDate>
    <dc:creator>djheathy</dc:creator>
    <dc:date>2020-04-27T13:48:24Z</dc:date>
    <item>
      <title>Active records over time based on Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-records-over-time-based-on-Criteria/m-p/1051008#M14380</link>
      <description>&lt;P&gt;I have a services table (Fact) and a Service Type (Dimension) table. Each service has a cost, a start and end date, which is linked to a customer and a service type. I also have an active flag on the Services table where the service is currently active.&lt;BR /&gt;Each customer can have many active services at once.&lt;BR /&gt;&lt;BR /&gt;I've created a couple of calculations to show a count of customers with active services over time:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Number of active customers =&lt;/P&gt;&lt;P&gt;CALCULATE(&lt;BR /&gt;DISTINCTCOUNT('Services'[Person_ID])&lt;BR /&gt;,Filter('Services','Services'[START_DTTM]&amp;lt;=now())&lt;BR /&gt;,FILTER('Services','Services'[END_DTTM]&amp;gt;=now())&lt;/P&gt;&lt;P&gt;)&lt;BR /&gt;&lt;BR /&gt;and&amp;nbsp; which shows the active users with services of a specific type over $600&lt;/P&gt;&lt;P&gt;users with total Services $600+ =&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Calculate(&lt;BR /&gt;DISTINCTCOUNT('Services'[PERSON_ID]),&lt;BR /&gt;FILTER('Services','Services'[Active]=1),&lt;/P&gt;&lt;P&gt;Filter('Services',(&lt;BR /&gt;CALCULATE(sum('Services'[Cost]),&lt;BR /&gt;ALLEXCEPT('Services',&lt;BR /&gt;'Services'[PERSON_ID],&lt;BR /&gt;'Services'[Active],&lt;BR /&gt;'Service Type'[ServiceGroup]&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;BR /&gt;))&amp;gt;600&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Now, I want to combine the two. However, if I add the filter from the first calculation into the second, I need to add start date and end date into the ALLEXCEPT clause, however, this then only groups together services that start and end on the same day, which doesn't give me the desired result. Any help would be great. Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Apr 2020 13:48:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-records-over-time-based-on-Criteria/m-p/1051008#M14380</guid>
      <dc:creator>djheathy</dc:creator>
      <dc:date>2020-04-27T13:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Active records over time based on Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-records-over-time-based-on-Criteria/m-p/1051141#M14383</link>
      <description>&lt;P&gt;Hi there.&lt;/P&gt;
&lt;P&gt;Hard-coding values (&lt;STRONG&gt;now()&lt;/STRONG&gt;) into measures like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Number of active customers =

CALCULATE(
DISTINCTCOUNT('Services'[Person_ID])
,Filter('Services','Services'[START_DTTM]&amp;lt;=now())
,FILTER('Services','Services'[END_DTTM]&amp;gt;=now())

)&lt;/LI-CODE&gt;
&lt;P&gt;is not how it should be done. The way you've done it prevents you from showing the number of active customers over time since the conditions are fixed at today's date instead of being definable by the user.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;P&gt;D&lt;/P&gt;</description>
      <pubDate>Mon, 27 Apr 2020 14:17:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-records-over-time-based-on-Criteria/m-p/1051141#M14383</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-27T14:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: Active records over time based on Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-records-over-time-based-on-Criteria/m-p/1051257#M14387</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies I wasn't too clear. The piece of code that you quoted was just where I have calculated currently active services. To see them over time, I have tried something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Calculate(&lt;BR /&gt;DISTINCTCOUNT('Services'[PERSON_ID]),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FILTER('Services','Services'[START_Date]&amp;lt;=LASTDATE('Date'[Date])&amp;amp;&amp;amp;[END_Date]&amp;gt;=LASTDATE('Date'[Date])),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Filter('Services',(&lt;BR /&gt;CALCULATE(sum('Services'[COST]),&lt;BR /&gt;ALLEXCEPT(&lt;BR /&gt;'Services',&lt;BR /&gt;'Services'[PERSON_ID],&lt;BR /&gt;'Service Type'[ServiceGroup])))&amp;gt;600)&lt;/P&gt;&lt;P&gt;)&lt;BR /&gt;However, this doesn't work as the ALLEXCEPT clears the dynamic date filter used to see the count over time. If I add START_Date and END_Date into the ALLEXCEPT function then it only groups services where the start and end date are the same.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Apr 2020 14:59:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-records-over-time-based-on-Criteria/m-p/1051257#M14387</guid>
      <dc:creator>djheathy</dc:creator>
      <dc:date>2020-04-27T14:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: Active records over time based on Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-records-over-time-based-on-Criteria/m-p/1051423#M14396</link>
      <description>That's because you need a disconnected date table to show the number of active services or the number of customers with active services. A connected table will not achieve what you need.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
      <pubDate>Mon, 27 Apr 2020 15:53:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-records-over-time-based-on-Criteria/m-p/1051423#M14396</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-27T15:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: Active records over time based on Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-records-over-time-based-on-Criteria/m-p/1051495#M14401</link>
      <description>&lt;P&gt;The date table is disconnected, so it works over time.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;However, I think the problem lies in the fact that I need to add the a dynamic 'active' flag into the ALLEXCEPT function, because I need to group all the active services to see which customers have over $600 at the time of the calculation.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Is there a way I can do that in a variable and then add the result of the variable into the ALLEXCEPT function?&lt;BR /&gt;&lt;BR /&gt;Something like this:&lt;BR /&gt;&lt;BR /&gt;Active users &amp;gt;$600 over time=&lt;BR /&gt;&lt;BR /&gt;Var&lt;BR /&gt;&lt;STRONG&gt;ACTIVEUSERS&lt;/STRONG&gt;= calculate(1,FILTER('Services','Services'[START_Date]&amp;lt;=LASTDATE('Date'[Date])&amp;amp;&amp;amp;[END_Date]&amp;gt;=LASTDATE('Date'[Date])))&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Calculate(&lt;BR /&gt;DISTINCTCOUNT('Services'[PERSON_ID]),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Filter('Services',(&lt;BR /&gt;CALCULATE(sum('Services'[COST]),&lt;BR /&gt;ALLEXCEPT(&lt;BR /&gt;'Services',&lt;BR /&gt;'Services'[PERSON_ID],&lt;BR /&gt;'Service Type'[ServiceGroup],&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ACTIVEUSERS&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;)))&amp;gt;600)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know this is wrong, but hopefully you can logically see where I'm trying to go with this&lt;/P&gt;</description>
      <pubDate>Mon, 27 Apr 2020 16:25:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-records-over-time-based-on-Criteria/m-p/1051495#M14401</guid>
      <dc:creator>djheathy</dc:creator>
      <dc:date>2020-04-27T16:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: Active records over time based on Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-records-over-time-based-on-Criteria/m-p/1052111#M14416</link>
      <description>&lt;P&gt;Check out the file. No field "Service Active" required since this can be deduced from the start and end dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best&lt;BR /&gt;D&lt;/P&gt;</description>
      <pubDate>Mon, 27 Apr 2020 22:43:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-records-over-time-based-on-Criteria/m-p/1052111#M14416</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-27T22:43:06Z</dc:date>
    </item>
  </channel>
</rss>

