<?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: DAX - How to  Count the Consecutive Occurrences in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1139645#M17048</link>
    <description>&lt;P&gt;Issue not solved yet!&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jun 2020 17:42:01 GMT</pubDate>
    <dc:creator>Muhannadtaghi</dc:creator>
    <dc:date>2020-06-03T17:42:01Z</dc:date>
    <item>
      <title>DAX - How to  Count the Consecutive Occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1127777#M16664</link>
      <description>&lt;P&gt;Hi There;&lt;/P&gt;&lt;P&gt;I would like to count the consecutive worked days for a group of employees, I have a table of employee work date, employee ID, employee name as shown below and I wont to identify who worked 2 or more days in a row.&lt;/P&gt;&lt;P&gt;I need your help to suggest a DAX that count the consecutive occurrence only, for example, in my table below the employee Jones worked 2 days in a row in the 3rd and 4th days of the month, this should be one occurrence and he worked 2 days in a row in the 12th and 13th days of the month, that should be another separate occurrence.&lt;/P&gt;&lt;P&gt;All that being said, I need a DAX for counting the consecutive occurrences separately for each employee but not accumulatively.&lt;/P&gt;&lt;P&gt;Please feel free to contact me with any questions/ clarifications.&lt;/P&gt;&lt;P&gt;Many thanks,&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Employee ID&lt;/TD&gt;&lt;TD&gt;Employee Name&lt;/TD&gt;&lt;TD&gt;Consecutive Days&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/1/2020&lt;/TD&gt;&lt;TD&gt;0011&lt;/TD&gt;&lt;TD&gt;Sam&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/2/2020&lt;/TD&gt;&lt;TD&gt;0012&lt;/TD&gt;&lt;TD&gt;Jim&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/3/2020&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;&lt;STRONG&gt;0013&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;&lt;STRONG&gt;Jones&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/4/2020&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;&lt;STRONG&gt;0013&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;&lt;STRONG&gt;Jones&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/5/2020&lt;/TD&gt;&lt;TD&gt;0011&lt;/TD&gt;&lt;TD&gt;Sam&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/6/2020&lt;/TD&gt;&lt;TD&gt;0014&lt;/TD&gt;&lt;TD&gt;Joseph&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/7/2020&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;&lt;STRONG&gt;0011&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;&lt;STRONG&gt;Sam&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/8/2020&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;&lt;STRONG&gt;0011&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;&lt;STRONG&gt;Sam&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/9/2020&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;&lt;STRONG&gt;0011&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;&lt;STRONG&gt;Sam&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/10/2020&lt;/TD&gt;&lt;TD&gt;0012&lt;/TD&gt;&lt;TD&gt;Jim&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/11/2020&lt;/TD&gt;&lt;TD&gt;0014&lt;/TD&gt;&lt;TD&gt;Joseph&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/12/2020&lt;/TD&gt;&lt;TD&gt;0013&lt;/TD&gt;&lt;TD&gt;Jones&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/13/2020&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;&lt;STRONG&gt;0013&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;&lt;STRONG&gt;Jones&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Thu, 28 May 2020 21:25:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1127777#M16664</guid>
      <dc:creator>Muhannadtaghi</dc:creator>
      <dc:date>2020-05-28T21:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: DAX - How to  Count the Consecutive Occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1127889#M16669</link>
      <description>&lt;P&gt;Here is one approach to do this.&amp;nbsp; It does a calculation to find the last date the employee did not work, so I needed to create a Date table called "WorkDates" that has all dates with WorkDates = CALENDAR(MIN(Work[Date]), MAX(Work[Date])).&amp;nbsp; But you can adapt this for any Date table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Number Consecutive Days =&lt;BR /&gt;VAR selecteddate =&lt;BR /&gt;SELECTEDVALUE ( 'WorkDates'[Date] )&lt;BR /&gt;VAR lastnotworkeddate =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;MAXX (&lt;BR /&gt;FILTER ( WorkDates, ISBLANK ( CALCULATE ( COUNTROWS ( 'Work' ) ) ) ),&lt;BR /&gt;WorkDates[Date]&lt;BR /&gt;),&lt;BR /&gt;WorkDates[Date] &amp;lt; selecteddate&lt;BR /&gt;)&lt;BR /&gt;VAR diff =&lt;BR /&gt;DATEDIFF ( lastnotworkeddate, selecteddate, DAY )&lt;BR /&gt;RETURN&lt;BR /&gt;IF ( COUNTROWS ( 'Work' ) &amp;gt; 0, IF ( diff &amp;gt; 1, diff ) )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this works for you, please mark it as solution.&amp;nbsp; Kudos are appreciated too.&amp;nbsp; Please let me know if not.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pat&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 23:31:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1127889#M16669</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-05-28T23:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: DAX - How to  Count the Consecutive Occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1129842#M16718</link>
      <description>&lt;P&gt;Hi Mahoneypat;&lt;/P&gt;&lt;P&gt;Thanks a lot for your support. Unfortunately, it did not work, it was showing blank.&lt;/P&gt;&lt;P&gt;Below are all the steps that I did to test it out:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I renamed the same example table that I shared with you to “Work” to align with the date table and DAX&lt;/LI&gt;&lt;LI&gt;Created the “WorkDates” table&lt;/LI&gt;&lt;LI&gt;Applied the DAX exactly as you post it, please see below.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Please advise if I missed something?&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 17:01:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1129842#M16718</guid>
      <dc:creator>Muhannadtaghi</dc:creator>
      <dc:date>2020-05-29T17:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: DAX - How to  Count the Consecutive Occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1130752#M16778</link>
      <description>&lt;P&gt;Did you make a 1:Many relationship between WorkDates and Work tables?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pat&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 May 2020 13:02:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1130752#M16778</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-05-30T13:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: DAX - How to  Count the Consecutive Occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1130892#M16789</link>
      <description>&lt;P&gt;Hi mahoneypat;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply, I tried all 4 different types of cardinalities and all types of cross filter directions, but still showing blank.&lt;/P&gt;&lt;P&gt;Also, I used the DAX in measure and calculation column, but nothing changed.&lt;/P&gt;&lt;P&gt;Please advise.&lt;/P&gt;&lt;P&gt;Many thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 30 May 2020 17:03:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1130892#M16789</guid>
      <dc:creator>Muhannadtaghi</dc:creator>
      <dc:date>2020-05-30T17:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: DAX - How to  Count the Consecutive Occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1131000#M16795</link>
      <description>&lt;P&gt;My bad for not clarifying I was using the measure in a table with WorkDates[Date] and Work[EmployeeID].&amp;nbsp; To use it in a card, use this measure that references the first one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Total Consecutive Days =&lt;BR /&gt;SUMX (&lt;BR /&gt;SUMMARIZE ( 'Work', WorkDates[Date], 'Work'[Employee ID] ),&lt;BR /&gt;[Number Consecutive Days]&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the relationship needs to be changed back too.&amp;nbsp; 1:Many from WorkDates to Work (Filter going 1:many too).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this works for you, please mark it as solution.&amp;nbsp; Kudos are appreciated too.&amp;nbsp; Please let me know if not.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pat&lt;/P&gt;</description>
      <pubDate>Sat, 30 May 2020 18:47:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1131000#M16795</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-05-30T18:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: DAX - How to  Count the Consecutive Occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1131220#M16802</link>
      <description>&lt;P&gt;Hi Pat;&lt;/P&gt;&lt;P&gt;Thanks for the comment, could you please share with me the pbix file so I can see how you did it?&lt;/P&gt;&lt;P&gt;Many thanks for the support,&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 31 May 2020 01:55:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1131220#M16802</guid>
      <dc:creator>Muhannadtaghi</dc:creator>
      <dc:date>2020-05-31T01:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: DAX - How to  Count the Consecutive Occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1139645#M17048</link>
      <description>&lt;P&gt;Issue not solved yet!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 17:42:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1139645#M17048</guid>
      <dc:creator>Muhannadtaghi</dc:creator>
      <dc:date>2020-06-03T17:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: DAX - How to  Count the Consecutive Occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1650075#M33584</link>
      <description>&lt;P&gt;Here is a link to GoogleDrive. I have used some intermediar columns. Hope this works for you&lt;BR /&gt;&lt;A href="https://drive.google.com/file/d/1lIus89C5W_VpzmKptRMHeXJeHtiwckul/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/1lIus89C5W_VpzmKptRMHeXJeHtiwckul/view?usp=sharing&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Feb 2021 16:30:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/1650075#M33584</guid>
      <dc:creator>JW_van_Holst</dc:creator>
      <dc:date>2021-02-07T16:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: DAX - How to  Count the Consecutive Occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/2041007#M45821</link>
      <description>&lt;P&gt;Did this solution ever work?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 16:59:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/2041007#M45821</guid>
      <dc:creator>lstevens</dc:creator>
      <dc:date>2021-08-26T16:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: DAX - How to  Count the Consecutive Occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/3077116#M107027</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="226208" data-lia-user-login="mahoneypat" class="lia-mention lia-mention-user"&gt;mahoneypat&lt;/a&gt;&amp;nbsp;, I am trying to use your measure above and it is not working. I am wondering if it is due to the last statement?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&lt;STRONG&gt;IF ( COUNTROWS ( 'Work' ) &amp;gt; 0, IF ( diff &amp;gt; 1, diff ) )&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Is the true statement missing from the first part and the false statement missing from the second statement?&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080"&gt;&lt;SPAN&gt;IF ( COUNTROWS ( 'Work' ) &amp;gt; 0 &lt;FONT color="#FF0000"&gt;[&lt;STRONG&gt;True&lt;/STRONG&gt; missing]&lt;/FONT&gt;,&amp;nbsp;IF ( diff &amp;gt; 1, diff ),&amp;nbsp;&lt;FONT color="#FF0000"&gt;[&lt;STRONG&gt;False&lt;/STRONG&gt; missing]&lt;/FONT&gt; )&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2023 07:06:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/3077116#M107027</guid>
      <dc:creator>Meagan_Lea</dc:creator>
      <dc:date>2023-02-13T07:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: DAX - How to  Count the Consecutive Occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/3081749#M107450</link>
      <description>&lt;P&gt;With the IF function, if you don't provide a false option, it returns blank. The expression is complete, accepting the default BLANK() for both falses.&lt;/P&gt;&lt;P&gt;Pat&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 15:38:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/3081749#M107450</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2023-02-15T15:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: DAX - How to  Count the Consecutive Occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/3081957#M107470</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="226492" data-lia-user-login="Muhannadtaghi" class="lia-mention lia-mention-user"&gt;Muhannadtaghi&lt;/a&gt;&amp;nbsp; you would need an rowNum/Index column in the dataset and then you can write a measure like this&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;prev = 
VAR prevIndex =
    CALCULATE (
        MAX ( 'Table'[Index] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Index] = MAX ( 'Table'[Index] ) - 1 )
    )
VAR prevId =
    CALCULATE (
        MAX ( 'Table'[Employee ID] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Index] = prevIndex )
    )
VAR cond =
    IF ( MAX ( 'Table'[Employee ID] ) &amp;lt;&amp;gt; prevId, MAX ( 'Table'[Index] ) ) 
RETURN
    cond



consecutiveDaysCount = 
VAR currDate =
    MAX ( 'Table'[Date] )
VAR curr =
    MAX ( 'Table'[Index] )
VAR __topN =
    MAXX (
        TOPN (
            1,
            FILTER (
                SUMMARIZE (
                    FILTER (
                        ALL ( 'Table' ),
                        'Table'[Employee Name] = MAX ( 'Table'[Employee Name] )
                            &amp;amp;&amp;amp; 'Table'[Index] &amp;lt;= [prev]
                    ),
                    'Table'[Index]
                ),
                [Index] &amp;lt;= curr
            ),
            [Index], DESC
        ),
        [Index]
    )
VAR test =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Index] = __topN )
    ) 
--var debugger = TOCSV(__lastDate, -1, ",")
RETURN
    DATEDIFF ( test, currDate, DAY )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 17:36:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/3081957#M107470</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2023-02-15T17:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: DAX - How to  Count the Consecutive Occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/3399832#M128334</link>
      <description>&lt;P&gt;Thank you for this, this is already a great explanation. I am trying to do something similar, except the Index column won't work because, say there are multiple people who work on the same day - this is what my data is like. For example:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Date -- Name&amp;nbsp;&lt;/P&gt;&lt;P&gt;1/1/23 -- John&lt;/P&gt;&lt;P&gt;1/2/23 -- Sam&lt;/P&gt;&lt;P&gt;1/3/23 -- Sam&lt;/P&gt;&lt;P&gt;1/3/23 -- Dave&lt;/P&gt;&lt;P&gt;1/4/23 -- Sam&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the bottom record, we would want Sam to show 3 days, but if you use the Index, it wouldn't catch it because of the "Dave" record. Any ideas to amend above to calculate the consecutive days for this case?? Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 25 Aug 2023 19:48:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-How-to-Count-the-Consecutive-Occurrences/m-p/3399832#M128334</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-25T19:48:59Z</dc:date>
    </item>
  </channel>
</rss>

