<?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 Count changes in a field (with date) in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Count-changes-in-a-field-with-date/m-p/3438574#M44537</link>
    <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table with these fields:&lt;/P&gt;&lt;P&gt;- employee: ID number of the worker&lt;/P&gt;&lt;P&gt;- location: "home" or "office"&lt;/P&gt;&lt;P&gt;- date: each day the employee worked&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to count how many changes from "home" to "office" or "office" to "home" had each employee. Of course, each change should be coherent in time. For example, for one employee:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;date&lt;/TD&gt;&lt;TD&gt;Location&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;25/09&lt;/TD&gt;&lt;TD&gt;home&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;26/09&lt;/TD&gt;&lt;TD&gt;office&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;27/09&lt;/TD&gt;&lt;TD&gt;home&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;28/09&lt;/TD&gt;&lt;TD&gt;home&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29/09&lt;/TD&gt;&lt;TD&gt;home&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the count should be 2. How can I do that? I may also need to detail only the changes. Which is the best approach? A new column with M? A new table? I discard the measure, because of that need of the detailed info of only the changes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
    <pubDate>Tue, 19 Sep 2023 16:16:25 GMT</pubDate>
    <dc:creator>grojnak</dc:creator>
    <dc:date>2023-09-19T16:16:25Z</dc:date>
    <item>
      <title>Count changes in a field (with date)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Count-changes-in-a-field-with-date/m-p/3438574#M44537</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table with these fields:&lt;/P&gt;&lt;P&gt;- employee: ID number of the worker&lt;/P&gt;&lt;P&gt;- location: "home" or "office"&lt;/P&gt;&lt;P&gt;- date: each day the employee worked&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to count how many changes from "home" to "office" or "office" to "home" had each employee. Of course, each change should be coherent in time. For example, for one employee:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;date&lt;/TD&gt;&lt;TD&gt;Location&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;25/09&lt;/TD&gt;&lt;TD&gt;home&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;26/09&lt;/TD&gt;&lt;TD&gt;office&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;27/09&lt;/TD&gt;&lt;TD&gt;home&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;28/09&lt;/TD&gt;&lt;TD&gt;home&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29/09&lt;/TD&gt;&lt;TD&gt;home&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the count should be 2. How can I do that? I may also need to detail only the changes. Which is the best approach? A new column with M? A new table? I discard the measure, because of that need of the detailed info of only the changes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 16:16:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Count-changes-in-a-field-with-date/m-p/3438574#M44537</guid>
      <dc:creator>grojnak</dc:creator>
      <dc:date>2023-09-19T16:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Count changes in a field (with date)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Count-changes-in-a-field-with-date/m-p/3440799#M44588</link>
      <description>&lt;P&gt;Yes, this can easily be done in Power Query via grouping.&amp;nbsp; Read about &lt;STRONG&gt;GroupKind.Local&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 02:00:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Count-changes-in-a-field-with-date/m-p/3440799#M44588</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-09-21T02:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: Count changes in a field (with date)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Count-changes-in-a-field-with-date/m-p/3440962#M44590</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/476549"&gt;@grojnak&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you to try code as below to create a measure.&lt;/P&gt;
&lt;P&gt;My Sample:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vrzhoumsft_0-1695276559847.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/971556i5C5FD9D80E2DA57D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vrzhoumsft_0-1695276559847.png" alt="vrzhoumsft_0-1695276559847.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Count Location Change For Employee =
VAR _SUMMARIZE =
    SUMMARIZE (
        ADDCOLUMNS (
            'Table',
            "CheckPoint",
                CALCULATE (
                    MIN ( 'Table'[date] ),
                    FILTER (
                        ALLEXCEPT ( 'Table', 'Table'[Employee ID] ),
                        'Table'[date] &amp;gt; EARLIER ( [date] )
                            &amp;amp;&amp;amp; 'Table'[Location] &amp;lt;&amp;gt; EARLIER ( [Location] )
                    )
                )
        ),
        [Employee ID],
        [CheckPoint]
    )
RETURN
    COUNTX ( _SUMMARIZE, [CheckPoint] )&lt;/LI-CODE&gt;
&lt;P&gt;Result is as below.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vrzhoumsft_1-1695276579324.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/971557i7C1E88496EF47E09/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vrzhoumsft_1-1695276579324.png" alt="vrzhoumsft_1-1695276579324.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 06:10:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Count-changes-in-a-field-with-date/m-p/3440962#M44590</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-09-21T06:10:21Z</dc:date>
    </item>
  </channel>
</rss>

