<?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: Count people still present with table event in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-people-still-present-with-table-event/m-p/2526409#M70656</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please check the attached pbix file.&lt;/P&gt;
&lt;P&gt;I am not sure if I understood your question correctly, because I could not know how your data model looks like, however, I tried to create a sample pbix file like the attached.&lt;/P&gt;
&lt;P&gt;The DAX measure is in the attached pbix file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Present ID count measure: =
VAR newtable =
    ADDCOLUMNS (
        DISTINCT ( 'ID'[ID] ),
        "@arrival", CALCULATE ( MAXX ( FILTER ( Data, Data[Event] = "Arrival" ), Data[Date] ) ),
        "@exit", CALCULATE ( MAXX ( FILTER ( Data, Data[Event] = "Exit" ), Data[Date] ) )
    )
VAR filternewtable =
    FILTER (
        newtable,
        [@arrival] &amp;lt;= MAX ( 'Calendar'[Date] )
            &amp;amp;&amp;amp; [@exit] &amp;gt;= MIN ( 'Calendar'[Date] )
    )
RETURN
    COUNTROWS ( filternewtable )
&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 19 May 2022 12:17:04 GMT</pubDate>
    <dc:creator>Jihwan_Kim</dc:creator>
    <dc:date>2022-05-19T12:17:04Z</dc:date>
    <item>
      <title>Count people still present with table event</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-people-still-present-with-table-event/m-p/2525862#M70616</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;It should be simple but I'm a little confused&lt;/P&gt;&lt;P&gt;I have an event table ID_PERSON, CODE_EVENT (Arrival and Exit) , DATE_EVENT&lt;BR /&gt;I need to count the people still present with a contextual period filter.&lt;/P&gt;&lt;P&gt;If I filter by period I have people who arrived outside the selected period but are still present.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your leads &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2022 09:12:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-people-still-present-with-table-event/m-p/2525862#M70616</guid>
      <dc:creator>nicomano77</dc:creator>
      <dc:date>2022-05-19T09:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: Count people still present with table event</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-people-still-present-with-table-event/m-p/2526409#M70656</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please check the attached pbix file.&lt;/P&gt;
&lt;P&gt;I am not sure if I understood your question correctly, because I could not know how your data model looks like, however, I tried to create a sample pbix file like the attached.&lt;/P&gt;
&lt;P&gt;The DAX measure is in the attached pbix file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Present ID count measure: =
VAR newtable =
    ADDCOLUMNS (
        DISTINCT ( 'ID'[ID] ),
        "@arrival", CALCULATE ( MAXX ( FILTER ( Data, Data[Event] = "Arrival" ), Data[Date] ) ),
        "@exit", CALCULATE ( MAXX ( FILTER ( Data, Data[Event] = "Exit" ), Data[Date] ) )
    )
VAR filternewtable =
    FILTER (
        newtable,
        [@arrival] &amp;lt;= MAX ( 'Calendar'[Date] )
            &amp;amp;&amp;amp; [@exit] &amp;gt;= MIN ( 'Calendar'[Date] )
    )
RETURN
    COUNTROWS ( filternewtable )
&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 19 May 2022 12:17:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-people-still-present-with-table-event/m-p/2526409#M70656</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-05-19T12:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: Count people still present with table event</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-people-still-present-with-table-event/m-p/2529426#M70865</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry,&amp;nbsp; next I will put pbix files .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot Jihwan_Kim it's so smart and really helpful !!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a great day !&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 12:41:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-people-still-present-with-table-event/m-p/2529426#M70865</guid>
      <dc:creator>nicomano77</dc:creator>
      <dc:date>2022-05-20T12:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Count people still present with table event</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-people-still-present-with-table-event/m-p/2577784#M73864</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry again to ask another question but I still stuck .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the case I need to have the second highest max arrival date How can i do that ? I tried with RANKX , TOPN without sucess, some advice in this case ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;VAR newtable =
    ADDCOLUMNS (
        DISTINCT ( 'ID'[ID] ),
        "@arrival", CALCULATE ( MAXX ( FILTER ( Data, Data[Event] = "Arrival" ), Data[Date] ) ),
        "@exit", CALCULATE ( MAXX ( FILTER ( Data, Data[Event] = "Exit" ), Data[Date] ) )
    )&lt;/PRE&gt;&lt;P&gt;thanks again&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nicomano&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&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;wrote:&lt;BR /&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Please check the attached pbix file.&lt;/P&gt;&lt;P&gt;I am not sure if I understood your question correctly, because I could not know how your data model looks like, however, I tried to create a sample pbix file like the attached.&lt;/P&gt;&lt;P&gt;The DAX measure is in the attached pbix file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nicomano&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 13:34:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-people-still-present-with-table-event/m-p/2577784#M73864</guid>
      <dc:creator>nicomano77</dc:creator>
      <dc:date>2022-06-14T13:34:54Z</dc:date>
    </item>
  </channel>
</rss>

