<?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 Cumulative Count for Inactive Relationship in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-Count-for-Inactive-Relationship/m-p/965016#M11424</link>
    <description>&lt;P&gt;I'm trying to get a running count of active projects in each month. I've managed to do two measures that calculate the cumulative number of projects created, the same for projects closed, and then take one from the other.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data is set out like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;MainCode&lt;/TD&gt;&lt;TD&gt;Type&lt;/TD&gt;&lt;TD&gt;CreatedDate&lt;/TD&gt;&lt;TD&gt;DoneDate&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;01/01/2018&lt;/TD&gt;&lt;TD&gt;25/01/2018&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;05/01/2018&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;03/02/2018&lt;/TD&gt;&lt;TD&gt;05/02/2018&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;04/02/2018&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;20/02/2018&lt;/TD&gt;&lt;TD&gt;10/06/2018&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;03/03/2018&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the running active count would be:&lt;/P&gt;&lt;P&gt;Jan: 1&lt;/P&gt;&lt;P&gt;Feb: 3 (as the 20/02 project didn't close until June)&lt;/P&gt;&lt;P&gt;Mar: 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(NB: Active relationship between [CreatedDate] and [Calendar Date] from my Date Table, inactive join between [DoneDate] and [Calendar Date]. Some [Types] are also "2" or "3" which I don't want to count)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_ActiveCasesInMonth = 

VAR AllProjs =  CALCULATE(DISTINCTCOUNT(MainData[MainCode]),MainData[Type]="1",FILTER ( ALL( DateTable ), DateTable[Calendar Date] &amp;lt;= MAX ( DateTable[Calendar Date] ) ))

VAR ClosedProjs = CALCULATE(DISTINCTCOUNT(MainData[MainCode]),MainData[Type]="1",USERELATIONSHIP(DateTable[Calendar Date],MainData[DoneDate]),FILTER ( ALLSELECTED( DateTable ), DateTable[Calendar Date] &amp;lt;= MAX ( DateTable[Calendar Date] ) ))

Return

AllProjs-ClosedProjs&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem is, I'm doing a running count from 01/01/2018 (as some projects from then are still not closed), but I currently only want to display the current financial year (01/04/2019 to 31/03/2020) in a visual - when I filter the bar chart to this FY (using a MonthYear column from the Date Table) the running total of 'ClosedProjs' is changing along with it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm guessing it's my use of ALLSELECTED in that's allowing the filters to have an effect, but using ALL gives me a wrong total to begin with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If someone can point me in the right direction that would be great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P class="ics-element-donot-delete 1001_CC@"&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Mar 2020 15:06:18 GMT</pubDate>
    <dc:creator>Socrates</dc:creator>
    <dc:date>2020-03-09T15:06:18Z</dc:date>
    <item>
      <title>Cumulative Count for Inactive Relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-Count-for-Inactive-Relationship/m-p/965016#M11424</link>
      <description>&lt;P&gt;I'm trying to get a running count of active projects in each month. I've managed to do two measures that calculate the cumulative number of projects created, the same for projects closed, and then take one from the other.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data is set out like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;MainCode&lt;/TD&gt;&lt;TD&gt;Type&lt;/TD&gt;&lt;TD&gt;CreatedDate&lt;/TD&gt;&lt;TD&gt;DoneDate&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;01/01/2018&lt;/TD&gt;&lt;TD&gt;25/01/2018&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;05/01/2018&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;03/02/2018&lt;/TD&gt;&lt;TD&gt;05/02/2018&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;04/02/2018&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;20/02/2018&lt;/TD&gt;&lt;TD&gt;10/06/2018&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;03/03/2018&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the running active count would be:&lt;/P&gt;&lt;P&gt;Jan: 1&lt;/P&gt;&lt;P&gt;Feb: 3 (as the 20/02 project didn't close until June)&lt;/P&gt;&lt;P&gt;Mar: 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(NB: Active relationship between [CreatedDate] and [Calendar Date] from my Date Table, inactive join between [DoneDate] and [Calendar Date]. Some [Types] are also "2" or "3" which I don't want to count)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_ActiveCasesInMonth = 

VAR AllProjs =  CALCULATE(DISTINCTCOUNT(MainData[MainCode]),MainData[Type]="1",FILTER ( ALL( DateTable ), DateTable[Calendar Date] &amp;lt;= MAX ( DateTable[Calendar Date] ) ))

VAR ClosedProjs = CALCULATE(DISTINCTCOUNT(MainData[MainCode]),MainData[Type]="1",USERELATIONSHIP(DateTable[Calendar Date],MainData[DoneDate]),FILTER ( ALLSELECTED( DateTable ), DateTable[Calendar Date] &amp;lt;= MAX ( DateTable[Calendar Date] ) ))

Return

AllProjs-ClosedProjs&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem is, I'm doing a running count from 01/01/2018 (as some projects from then are still not closed), but I currently only want to display the current financial year (01/04/2019 to 31/03/2020) in a visual - when I filter the bar chart to this FY (using a MonthYear column from the Date Table) the running total of 'ClosedProjs' is changing along with it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm guessing it's my use of ALLSELECTED in that's allowing the filters to have an effect, but using ALL gives me a wrong total to begin with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If someone can point me in the right direction that would be great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P class="ics-element-donot-delete 1001_CC@"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 15:06:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-Count-for-Inactive-Relationship/m-p/965016#M11424</guid>
      <dc:creator>Socrates</dc:creator>
      <dc:date>2020-03-09T15:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative Count for Inactive Relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-Count-for-Inactive-Relationship/m-p/965200#M11428</link>
      <description>&lt;P&gt;Right, I went away and had a cup of tea and, of course, that's all I needed to see the solution:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR ClosedProjs = CALCULATE(DISTINCTCOUNT(MainData[MainCode]),MainData[Type]="1",USERELATIONSHIP(DateTable[Calendar Date],MainData[DoneDate]),Filter(All(DateTable),DateTable[Calendar Date] &amp;lt;=Max(DateTable[Calendar Date])),MainData[DoneDate])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Went with the ALL function, but remembed to use [DoneDate] as a filter in CALCULATE.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 16:21:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-Count-for-Inactive-Relationship/m-p/965200#M11428</guid>
      <dc:creator>Socrates</dc:creator>
      <dc:date>2020-03-09T16:21:37Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative Count for Inactive Relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-Count-for-Inactive-Relationship/m-p/2579044#M73945</link>
      <description>&lt;P&gt;Been trying to fix this all day, and this was the answer - thank you so much!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 04:10:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-Count-for-Inactive-Relationship/m-p/2579044#M73945</guid>
      <dc:creator>garyvz</dc:creator>
      <dc:date>2022-06-15T04:10:20Z</dc:date>
    </item>
  </channel>
</rss>

