<?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: Help on How to Create a Measure Based on Start &amp;amp; End Date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-on-How-to-Create-a-Measure-Based-on-Start-amp-End-Date/m-p/2475169#M67554</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So regarding this problem I had, can it be developed so that people with multiple start dates are counted? I notice in my real set of data that as we had more people&amp;nbsp; the actual results started to differ from reality by quite a margin! In the original data set there are some examples of this, for instance Name11 has 35 rows all with a start date of 13/4/2022... this is very possible as each row represents access to a different business unit, Name11 should, however, only be counted once, whereas at the moment they are not counted at all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;</description>
    <pubDate>Mon, 25 Apr 2022 14:03:59 GMT</pubDate>
    <dc:creator>andybamber</dc:creator>
    <dc:date>2022-04-25T14:03:59Z</dc:date>
    <item>
      <title>Help on How to Create a Measure Based on Start &amp; End Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-on-How-to-Create-a-Measure-Based-on-Start-amp-End-Date/m-p/2449287#M65863</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hoping someone could help me with some advice on how to build a measure&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table of users, with start and/or end timestamps. The table is an access history for the users.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some users appear multiple times where they have access to multiple org units e.g. Name6, and some others are there multiple times where their access has changed, and the previous access has ended e.g. Name9&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am trying to show on a year/month basis is the distinct count of users who had an ACTIVE access profile in that period. So for instance if I looked at November 2021 i would see a distinct count of 2... It needs to simultaneously look at the starttimestamp and endtimestamp to determine whether the user was active in that period. Again if we look at Name2 i would expect them to be counted in March 2022 and then April 2022 even though their end timestamp was half way through April&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;E.g file below&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="PBIX FILE" href="https://www.dropbox.com/s/bcxxs89rbsw3n90/PBI_Issues.pbix?dl=0" target="_self"&gt;PBIX FILE&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 10:38:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-on-How-to-Create-a-Measure-Based-on-Start-amp-End-Date/m-p/2449287#M65863</guid>
      <dc:creator>andybamber</dc:creator>
      <dc:date>2022-04-11T10:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help on How to Create a Measure Based on Start &amp; End Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-on-How-to-Create-a-Measure-Based-on-Start-amp-End-Date/m-p/2449297#M65864</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="255456" data-lia-user-login="andybamber" class="lia-mention lia-mention-user"&gt;andybamber&lt;/a&gt; , refer if one of these 2 can help&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-or-end-date/ba-p/1503785" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-or-end-date/ba-p/1503785&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 10:45:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-on-How-to-Create-a-Measure-Based-on-Start-amp-End-Date/m-p/2449297#M65864</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-04-11T10:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Help on How to Create a Measure Based on Start &amp; End Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-on-How-to-Create-a-Measure-Based-on-Start-amp-End-Date/m-p/2449661#M65879</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, this measure almost does what I need, except it does not provide a distinct count of user...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Current Employees = CALCULATE(COUNTx(FILTER(Employee,Employee[Start Date]&amp;lt;=max('Date'[Date]) &amp;amp;&amp;amp; (ISBLANK(Employee[End Date]) || Employee[End Date]&amp;gt;max('Date'[Date]))),(Employee[Employee Id ])),CROSSFILTER(Employee[Start Date],'Date'[Date],None))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know how i could incorporate this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 12:53:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-on-How-to-Create-a-Measure-Based-on-Start-amp-End-Date/m-p/2449661#M65879</guid>
      <dc:creator>andybamber</dc:creator>
      <dc:date>2022-04-11T12:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help on How to Create a Measure Based on Start &amp; End Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-on-How-to-Create-a-Measure-Based-on-Start-amp-End-Date/m-p/2450965#M65964</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="255456" data-lia-user-login="andybamber" class="lia-mention lia-mention-user"&gt;andybamber&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Here is the sample file with the solution&amp;nbsp;&lt;A href="https://www.dropbox.com/t/J56gVd2IbetcntOR" target="_blank"&gt;https://www.dropbox.com/t/J56gVd2IbetcntOR&lt;/A&gt;&lt;BR /&gt;For active users I assume a rolling number that, by time, increases when new users join and decreases when users leave. Therefore, when you say:&lt;BR /&gt;"&lt;SPAN&gt;&lt;EM&gt;So for instance if I looked at November 2021 i would see a distinct count of 2&lt;/EM&gt;"&lt;BR /&gt;I would consider that you mean 2 members will be added to the moving (rolling) total. I hope this is what you mean.&amp;nbsp;&lt;BR /&gt;One more thing need mention; this won't work properly if you have more than two start dates. The results won't be so accurate. If this is the case&amp;nbsp;please provide data that reflects the actual&amp;nbsp;scenario.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;New Users = 
IF ( 
    HASONEVALUE ( Date_Table[MonthInCalendar] ),
    DISTINCTCOUNT ( 'Table'[User] )
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;Active Users = 
VAR FirstDateInFilter =
    MIN ( Date_Table[Date] )
VAR LastDateInFilter =
    MAX  ( Date_Table[Date] )
RETURN
    IF (
        HASONEVALUE ( Date_Table[MonthInCalendar] ),
        CALCULATE (
            SUMX ( 
                VALUES ( 'Table'[User] ),
                VAR StartDate = 
                    CALCULATE ( MIN ( 'Table'[StartTimestamp] ) )
                VAR EndDate =
                    CALCULATE ( MAX ('Table'[EndTimestamp] ) )
                RETURN
                    IF (
                        StartDate &amp;lt;= LastDateInFilter
                            &amp;amp;&amp;amp; OR ( ISBLANK ( EndDate ), EndDate &amp;gt;= FirstDateInFilter ),
                        1,
                        0
                    )
            ),
            REMOVEFILTERS ( Date_Table )
        )
    )&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 03:26:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-on-How-to-Create-a-Measure-Based-on-Start-amp-End-Date/m-p/2450965#M65964</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-12T03:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help on How to Create a Measure Based on Start &amp; End Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-on-How-to-Create-a-Measure-Based-on-Start-amp-End-Date/m-p/2475169#M67554</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So regarding this problem I had, can it be developed so that people with multiple start dates are counted? I notice in my real set of data that as we had more people&amp;nbsp; the actual results started to differ from reality by quite a margin! In the original data set there are some examples of this, for instance Name11 has 35 rows all with a start date of 13/4/2022... this is very possible as each row represents access to a different business unit, Name11 should, however, only be counted once, whereas at the moment they are not counted at all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 14:03:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-on-How-to-Create-a-Measure-Based-on-Start-amp-End-Date/m-p/2475169#M67554</guid>
      <dc:creator>andybamber</dc:creator>
      <dc:date>2022-04-25T14:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help on How to Create a Measure Based on Start &amp; End Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-on-How-to-Create-a-Measure-Based-on-Start-amp-End-Date/m-p/2475250#M67558</link>
      <description>&lt;P&gt;I'll look into it and get baxk to you. Please remide me in a private message if I didn't&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 14:32:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-on-How-to-Create-a-Measure-Based-on-Start-amp-End-Date/m-p/2475250#M67558</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-25T14:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help on How to Create a Measure Based on Start &amp; End Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-on-How-to-Create-a-Measure-Based-on-Start-amp-End-Date/m-p/2476747#M67645</link>
      <description>&lt;P&gt;thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;, its appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 06:41:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-on-How-to-Create-a-Measure-Based-on-Start-amp-End-Date/m-p/2476747#M67645</guid>
      <dc:creator>andybamber</dc:creator>
      <dc:date>2022-04-26T06:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: Help on How to Create a Measure Based on Start &amp; End Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-on-How-to-Create-a-Measure-Based-on-Start-amp-End-Date/m-p/2479950#M67830</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="255456" data-lia-user-login="andybamber" class="lia-mention lia-mention-user"&gt;andybamber&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the updated file&amp;nbsp;&lt;A href="https://www.dropbox.com/t/1g0PtekIviN7lpGU" target="_blank"&gt;https://www.dropbox.com/t/1g0PtekIviN7lpGU&lt;/A&gt;&lt;BR /&gt;Not sure if I correctly understand the what is required but I did the following:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I modified the code [New Users] in oder to include duplicates in the count. So instead of counting user ID's we now count the number of rows.&lt;/LI&gt;&lt;LI&gt;The [Active Users] Measure has been updated accordingly.&lt;/LI&gt;&lt;LI&gt;The [Leaving Users] Measure has been added.&lt;/LI&gt;&lt;LI&gt;Fixed the Total to show correct values.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I hope this satisfies your requirements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;New Users = 
SUMX ( 
    VALUES ( Date_Table[MonthInCalendar] ),
    CALCULATE ( COUNTROWS ( 'Table' ) )
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;Leaving Users = 
VAR CurrentDateRange = VALUES ( Date_Table[Date] )
RETURN
    CALCULATE ( 
        SUMX ( 
            'Table',
            VAR EndDate = 'Table'[EndTimestamp]
            RETURN
                IF (
                    DATE ( YEAR ( EndDate ), MONTH ( EndDate ), DAY ( EndDate ) ) IN  CurrentDateRange
                        &amp;amp;&amp;amp; NOT ISBLANK ( 'Table'[EndTimestamp] ),
                    1
                )
        ),
        REMOVEFILTERS ( Date_Table )
    )&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;Active Users = 
VAR LastDateInFilter =
    MAX  ( Date_Table[Date] )
VAR FirstDateInFilter =
    DATE ( YEAR ( LastDateInFilter ), MONTH ( LastDateInFilter ) - 1, 1 )
RETURN
    CALCULATE (
        SUMX ( 
            'Table',
            VAR StartDate = 
                'Table'[StartTimestamp]
            VAR EndDate =
                'Table'[EndTimestamp]
            RETURN
                IF (
                    StartDate &amp;lt;= LastDateInFilter
                        &amp;amp;&amp;amp; OR ( ISBLANK ( EndDate ), EndDate &amp;gt;= FirstDateInFilter ),
                    1
                )
        ),
        REMOVEFILTERS ( Date_Table )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Have a great day!&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 09:32:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-on-How-to-Create-a-Measure-Based-on-Start-amp-End-Date/m-p/2479950#M67830</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-27T09:32:07Z</dc:date>
    </item>
  </channel>
</rss>

