<?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: Custom Column to Check if 2 consecutive months met a condition in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4627521#M177148</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="666800" data-lia-user-login="beanboy" class="lia-mention lia-mention-user"&gt;beanboy&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for reaching out to Microsoft Fabric Community Forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have taken sample data to reproduce your issue. Please test this query.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Call Month = MONTH(Calls[Call Date])
Call Year = YEAR(Calls[Call Date])
 
Two Consecutive Months Flag =
VAR CallsByMonth =
    ADDCOLUMNS(
        SUMMARIZE(
            Calls,
            Calls[Customer ID],
            Calls[Call Year],
            Calls[Call Month]
        ),
       "Calls Count", COUNTROWS(Calls),
       "Target", LOOKUPVALUE(Customers[Month Target], Customers[Customer ID], Calls[Customer ID])
    )
 
VAR ConsecutiveCheck =
    SUMX(
        CallsByMonth,
        VAR CurrentYear = Calls[Call Year]
        VAR CurrentMonth = Calls[Call Month]
        VAR CurrentMonthCalls = [Calls Count]
        VAR Target = [Target]
       
        VAR NextMonthCalls =
            CALCULATE(
                SUMX(CallsByMonth, [Calls Count]),
                FILTER(
                    CallsByMonth,
                    Calls[Customer ID] = EARLIER(Calls[Customer ID]) &amp;amp;&amp;amp;
                    Calls[Call Year] = CurrentYear &amp;amp;&amp;amp;
                    Calls[Call Month] = CurrentMonth + 1
                )
            )
 
        RETURN
            IF(CurrentMonthCalls &amp;gt; Target &amp;amp;&amp;amp; NextMonthCalls &amp;gt; Target, 1, 0)
    )
 
RETURN
    IF(ConsecutiveCheck &amp;gt; 0, "Yes", "No")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Vinay Pabbu&lt;/P&gt;</description>
    <pubDate>Thu, 27 Mar 2025 12:21:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2025-03-27T12:21:38Z</dc:date>
    <item>
      <title>Custom Column to Check if 2 consecutive months met a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4626286#M177091</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;I have a Customers table, and am looking for a way to add a flag column that flags if the Customer had 2 consecutive months of Calls that are greater than a target. The 'consecutive months' part is what is tripping me up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can do this the 'wrong' way of creating 12 variables, one for each Month, and doing a big series of checks:&lt;/P&gt;&lt;P&gt;IF ( M1 &amp;gt; Target &amp;amp;&amp;amp; M2 &amp;gt; Target || M2 &amp;gt; Target &amp;amp;&amp;amp; M3 &amp;gt; Target || etc..., "Flag" ) but I figure there's a better way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I asked Copilot and got started, but again, I'm getting stuck on the consecutive months part of this.&amp;nbsp;&lt;BR /&gt;First, for each row in the Customers table I am creating a temp table in memory that is storing the monthly Call volume for the trailing 12 months.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR __MonthlyTarget = 'Customers'[3 Month Target] / 3

VAR __EndDate = EOMONTH ( TODAY(), -1 )
VAR __StartDate = EOMONTH ( TODAY(), -13 )

VAR __Months = 
    SUMMARIZE (
        FILTER ( 
            'Calendar', 
            'Calendar'[Date] &amp;gt;= __StartDate &amp;amp;&amp;amp; 'Calendar'[Date] &amp;lt;= __EndDate
        ),
        'Calendar'[Month_Year],
        "Calls", 
            [#Calls]
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Now, I need to check if this __Months temp table has 2 consecutive rows of Calls &amp;gt; __MonthlyTarget.&lt;/P&gt;&lt;P&gt;Copilot is telling me something along the lines of the below code.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR __ConsecMonthsExceed =
    SUMX (
        FILTER ( 
            __Months,
            [Calls] &amp;gt; __MonthlyTarget &amp;amp;&amp;amp;
            CALCULATE ( 
                SUM ( [Calls] ),
                FILTER ( 
                    __Months,
                    [Month_Year] = EARLIER ( [Month_Year] ) +1
                ) 
            ) &amp;gt; __MonthlyTarget
        ),
        1
    )



RETURN 
IF ( __ConsecMonthExceeded &amp;gt; 0, "Flag" )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;The Month_Year column is a date value (i.e. 1/1/2025, 2/1/2025, etc) so yes I am aware doing [Month_Year] + 1 probably isn't going up a whole month, but actually a day. This needs to be cleaned up, but isn't what I am stuck on. Im stuck on the 2nd check of the next month's Calls. Thanks for the help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Mar 2025 17:11:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4626286#M177091</guid>
      <dc:creator>beanboy</dc:creator>
      <dc:date>2025-03-26T17:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Column to Check if 2 consecutive months met a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4626301#M177092</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="666800" data-lia-user-login="beanboy" class="lia-mention lia-mention-user"&gt;beanboy&lt;/a&gt;&amp;nbsp;Sorry, having trouble following, can you post sample data as text and expected output?&lt;BR /&gt;Not really enough information to go on, please first check if your issue is a common issue listed here: &lt;A href="https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Also, please see this post regarding How to Get Your Question Answered Quickly: &lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The most important parts are:&lt;BR /&gt;1. Sample data as text, use the table tool in the editing bar&lt;BR /&gt;2. Expected output from sample data&lt;BR /&gt;3. Explanation in words of how to get from 1. to 2.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Mar 2025 17:26:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4626301#M177092</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2025-03-26T17:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Column to Check if 2 consecutive months met a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4626327#M177095</link>
      <description>&lt;P&gt;Thanks for responding.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Lets say I have a Customers Table like the following:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Customer ID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Customer Name&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Month Target&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;2 Consecutive Months Flag&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C001&lt;/TD&gt;&lt;TD&gt;Cust1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C002&lt;/TD&gt;&lt;TD&gt;Cust2&lt;/TD&gt;&lt;TD&gt;3&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Customers table is related to the Calls fact table on the CustomerID field. There is one row in the table for each Call, and there can be multiple calls for a Customer on the same day&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Call ID&lt;/TD&gt;&lt;TD&gt;Call Date&lt;/TD&gt;&lt;TD&gt;Customer ID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1001&lt;/TD&gt;&lt;TD&gt;1/1/2025&lt;/TD&gt;&lt;TD&gt;C001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;1002&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;1/1/2025&lt;/TD&gt;&lt;TD&gt;C001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;1003&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;1/1/2025&lt;/TD&gt;&lt;TD&gt;C001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;1004&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;1/1/2025&lt;/TD&gt;&lt;TD&gt;C002&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;1005&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;1/2/2025&lt;/TD&gt;&lt;TD&gt;C001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;1006&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;1/2/2025&lt;/TD&gt;&lt;TD&gt;C002&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;1007&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;2/1/2025&lt;/TD&gt;&lt;TD&gt;C001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;1008&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;2/2/2025&lt;/TD&gt;&lt;TD&gt;C001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;1009&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;2/2/2025&lt;/TD&gt;&lt;TD&gt;C001&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;I have an existing measure to count calls:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#Calls = COUNTROWS ( Calls )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently it is March 26th, so the trailing 12 months is Mar 2024 - Feb 2025.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking to flag for each Customer if they had 2 &lt;U&gt;consecutive&lt;/U&gt; months between&amp;nbsp;Mar 2024 - Feb 2025 where the [#Calls] was greater than the Target.&lt;BR /&gt;&lt;BR /&gt;In the example data above, Customer C001 had 4 calls in Jan2025 and 3 in Feb2025, and their target for each month was 2, so C001 did have 2 consecutive months exceeding the target.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Mar 2025 17:41:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4626327#M177095</guid>
      <dc:creator>beanboy</dc:creator>
      <dc:date>2025-03-26T17:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Column to Check if 2 consecutive months met a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4626513#M177107</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="666800" data-lia-user-login="beanboy" class="lia-mention lia-mention-user"&gt;beanboy&lt;/a&gt;&amp;nbsp;have done this using calculated columns, please try this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Calls Per Month = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; YearMonthKey = &lt;/SPAN&gt;&lt;SPAN&gt;FORMAT&lt;/SPAN&gt;&lt;SPAN&gt;(Calls[Call Date], &lt;/SPAN&gt;&lt;SPAN&gt;"YYYYMM"&lt;/SPAN&gt;&lt;SPAN&gt;) &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;COUNT&lt;/SPAN&gt;&lt;SPAN&gt;(Calls[Call ID]), &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Calls,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Calls[Customer ID] = &lt;/SPAN&gt;&lt;SPAN&gt;EARLIER&lt;/SPAN&gt;&lt;SPAN&gt;(Calls[Customer ID]) &amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;FORMAT&lt;/SPAN&gt;&lt;SPAN&gt;(Calls[Call Date], &lt;/SPAN&gt;&lt;SPAN&gt;"YYYYMM"&lt;/SPAN&gt;&lt;SPAN&gt;) = YearMonthKey &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Exceeded Target = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; Target = &lt;/SPAN&gt;&lt;SPAN&gt;LOOKUPVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(Customers[Month Target], Customers[Customer ID], Calls[Customer ID])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt; &lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(Calls[Calls Per Month] &amp;gt; Target, &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Consecutive Exceeded Target = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; PreviousMonthExceeded = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(Calls[Exceeded Target]), &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Calls,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Calls[Customer ID] = &lt;/SPAN&gt;&lt;SPAN&gt;EARLIER&lt;/SPAN&gt;&lt;SPAN&gt;(Calls[Customer ID]) &amp;amp;&amp;amp; &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (Calls[Year] = &lt;/SPAN&gt;&lt;SPAN&gt;EARLIER&lt;/SPAN&gt;&lt;SPAN&gt;(Calls[Year]) &amp;amp;&amp;amp; Calls[Month] = &lt;/SPAN&gt;&lt;SPAN&gt;EARLIER&lt;/SPAN&gt;&lt;SPAN&gt;(Calls[Month]) - &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;) || &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (Calls[Year] = &lt;/SPAN&gt;&lt;SPAN&gt;EARLIER&lt;/SPAN&gt;&lt;SPAN&gt;(Calls[Year]) - &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp; &lt;/SPAN&gt;&lt;SPAN&gt;EARLIER&lt;/SPAN&gt;&lt;SPAN&gt;(Calls[Month]) = &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp; Calls[Month] = &lt;/SPAN&gt;&lt;SPAN&gt;12&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(Calls[Exceeded Target] = &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp; PreviousMonthExceeded = &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;img /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 26 Mar 2025 20:56:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4626513#M177107</guid>
      <dc:creator>techies</dc:creator>
      <dc:date>2025-03-26T20:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Column to Check if 2 consecutive months met a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4627521#M177148</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="666800" data-lia-user-login="beanboy" class="lia-mention lia-mention-user"&gt;beanboy&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for reaching out to Microsoft Fabric Community Forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have taken sample data to reproduce your issue. Please test this query.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Call Month = MONTH(Calls[Call Date])
Call Year = YEAR(Calls[Call Date])
 
Two Consecutive Months Flag =
VAR CallsByMonth =
    ADDCOLUMNS(
        SUMMARIZE(
            Calls,
            Calls[Customer ID],
            Calls[Call Year],
            Calls[Call Month]
        ),
       "Calls Count", COUNTROWS(Calls),
       "Target", LOOKUPVALUE(Customers[Month Target], Customers[Customer ID], Calls[Customer ID])
    )
 
VAR ConsecutiveCheck =
    SUMX(
        CallsByMonth,
        VAR CurrentYear = Calls[Call Year]
        VAR CurrentMonth = Calls[Call Month]
        VAR CurrentMonthCalls = [Calls Count]
        VAR Target = [Target]
       
        VAR NextMonthCalls =
            CALCULATE(
                SUMX(CallsByMonth, [Calls Count]),
                FILTER(
                    CallsByMonth,
                    Calls[Customer ID] = EARLIER(Calls[Customer ID]) &amp;amp;&amp;amp;
                    Calls[Call Year] = CurrentYear &amp;amp;&amp;amp;
                    Calls[Call Month] = CurrentMonth + 1
                )
            )
 
        RETURN
            IF(CurrentMonthCalls &amp;gt; Target &amp;amp;&amp;amp; NextMonthCalls &amp;gt; Target, 1, 0)
    )
 
RETURN
    IF(ConsecutiveCheck &amp;gt; 0, "Yes", "No")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Vinay Pabbu&lt;/P&gt;</description>
      <pubDate>Thu, 27 Mar 2025 12:21:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4627521#M177148</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-03-27T12:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Column to Check if 2 consecutive months met a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4635009#M177441</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="666800" data-lia-user-login="beanboy" class="lia-mention lia-mention-user"&gt;beanboy&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?&lt;BR /&gt;If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Vinay Pabbu&lt;/P&gt;</description>
      <pubDate>Wed, 02 Apr 2025 11:58:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4635009#M177441</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-04-02T11:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Column to Check if 2 consecutive months met a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4640986#M177705</link>
      <description>&lt;P&gt;Hi&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/666800" target="_blank"&gt;@beanboy&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?&lt;BR /&gt;If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Chaithanya.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Apr 2025 11:47:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4640986#M177705</guid>
      <dc:creator>v-kathullac</dc:creator>
      <dc:date>2025-04-07T11:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Column to Check if 2 consecutive months met a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4648590#M177941</link>
      <description>&lt;P&gt;Hi&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/666800" target="_blank" rel="noopener"&gt;@beanboy&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?&lt;BR /&gt;If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Chaithanya.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 11:37:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4648590#M177941</guid>
      <dc:creator>v-kathullac</dc:creator>
      <dc:date>2025-04-11T11:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Column to Check if 2 consecutive months met a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4657914#M178346</link>
      <description>&lt;P&gt;Hi&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/666800" target="_blank" rel="noopener"&gt;@beanboy&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?&lt;BR /&gt;If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Chaithanya.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Apr 2025 16:02:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Column-to-Check-if-2-consecutive-months-met-a-condition/m-p/4657914#M178346</guid>
      <dc:creator>v-kathullac</dc:creator>
      <dc:date>2025-04-17T16:02:42Z</dc:date>
    </item>
  </channel>
</rss>

