<?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: Getting consistent customers in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-consistent-customers/m-p/2686094#M80683</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&lt;/P&gt;
&lt;P&gt;I tried to create a sample pbix file like below.&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;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Past 3 months consistent customers count: = 
VAR _selectedcategory =
    VALUES ( Category[Category] )
VAR _pastmonthsnumberselect = 3
VAR _selectedmonthenddate =
    MAX ( 'Calendar'[End of Month] )
VAR _startdate =
    EOMONTH ( _selectedmonthenddate, - _pastmonthsnumberselect ) + 1
VAR _monthlycalendartable =
    SUMMARIZE (
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Date] &amp;lt;= _selectedmonthenddate
                &amp;amp;&amp;amp; 'Calendar'[Date] &amp;gt;= _startdate
        ),
        'Calendar'[Month-Year]
    )
VAR _newtable =
    FILTER (
        SUMMARIZE (
            ADDCOLUMNS (
                FILTER (
                    SUMMARIZE (
                        ALL ( Data ),
                        Category[Category],
                        Customer[Cust_ID],
                        'Calendar'[Month-Year]
                    ),
                    'Calendar'[Month-Year]
                        IN _monthlycalendartable
                        &amp;amp;&amp;amp; Category[Category] IN _selectedcategory
                ),
                "@amountsum", CALCULATE ( SUM ( Data[Amount] ) )
            ),
            Customer[Cust_ID],
            'Calendar'[Month-Year],
            [@amountsum]
        ),
        [@amountsum] &amp;lt;&amp;gt; 0
    )
VAR _groupbycustomer =
    FILTER (
        GROUPBY (
            _newtable,
            Customer[Cust_ID],
            "@monthcount", SUMX ( CURRENTGROUP (), 1 )
        ),
        [@monthcount] &amp;gt;= _pastmonthsnumberselect
    )
VAR _result =
    COUNTROWS ( _groupbycustomer )
RETURN
    _result + 0
&lt;/LI-CODE&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;LI-CODE lang="markup"&gt;Past 6 months consistent customers count: = 
VAR _selectedcategory =
    VALUES ( Category[Category] )
VAR _pastmonthsnumberselect = 6
VAR _selectedmonthenddate =
    MAX ( 'Calendar'[End of Month] )
VAR _startdate =
    EOMONTH ( _selectedmonthenddate, - _pastmonthsnumberselect ) + 1
VAR _monthlycalendartable =
    SUMMARIZE (
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Date] &amp;lt;= _selectedmonthenddate
                &amp;amp;&amp;amp; 'Calendar'[Date] &amp;gt;= _startdate
        ),
        'Calendar'[Month-Year]
    )
VAR _newtable =
    FILTER (
        SUMMARIZE (
            ADDCOLUMNS (
                FILTER (
                    SUMMARIZE (
                        ALL ( Data ),
                        Category[Category],
                        Customer[Cust_ID],
                        'Calendar'[Month-Year]
                    ),
                    'Calendar'[Month-Year]
                        IN _monthlycalendartable
                        &amp;amp;&amp;amp; Category[Category] IN _selectedcategory
                ),
                "@amountsum", CALCULATE ( SUM ( Data[Amount] ) )
            ),
            Customer[Cust_ID],
            'Calendar'[Month-Year],
            [@amountsum]
        ),
        [@amountsum] &amp;lt;&amp;gt; 0
    )
VAR _groupbycustomer =
    FILTER (
        GROUPBY (
            _newtable,
            Customer[Cust_ID],
            "@monthcount", SUMX ( CURRENTGROUP (), 1 )
        ),
        [@monthcount] &amp;gt;= _pastmonthsnumberselect
    )
VAR _result =
    COUNTROWS ( _groupbycustomer )
RETURN
    _result + 0&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Aug 2022 03:47:49 GMT</pubDate>
    <dc:creator>Jihwan_Kim</dc:creator>
    <dc:date>2022-08-08T03:47:49Z</dc:date>
    <item>
      <title>Getting consistent customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-consistent-customers/m-p/2685989#M80675</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;Im a beginner in PowerBI.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need help in creating this view.&lt;/P&gt;&lt;P&gt;Suppose I have this transactional dataset.&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;What I want to get are the counts of customers with consistent transaction for the past 3 months, 6 months, and even 12 months (relative to the month of reference and category)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the result I would want to achieve:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think this can be resolved through DAX but let I am open with any suggestions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 02:23:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-consistent-customers/m-p/2685989#M80675</guid>
      <dc:creator>JLMJ</dc:creator>
      <dc:date>2022-08-08T02:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: Getting consistent customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-consistent-customers/m-p/2686043#M80679</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="422861" data-lia-user-login="JLMJ" class="lia-mention lia-mention-user"&gt;JLMJ&lt;/a&gt; , Have date table, and have month year in your table/sales table &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sales Month = format([Date], "YYYYMM")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rolling 3= CALCULATE(distinctcount(Sales[Sales Month]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-3,MONTH))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Continue in the last three months&lt;/P&gt;
&lt;P&gt;countx(filter(Values(Sales[Customer]) , [Rolling 3]=3) , [Customer])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Same way change rolling to 6, 12 to get the number&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :&lt;A href="https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions" target="_blank"&gt;radacad&lt;/A&gt; &lt;A href="https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/" target="_blank"&gt;sqlbi&lt;/A&gt; &lt;A href="https://www.youtube.com/playlist?list=PLPaNVDMhUXGYLz-w8ERQOo3KYARs7GgG-" target="_blank"&gt;My Video Series&lt;/A&gt; Appreciate your Kudos. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :&lt;A href="https://youtu.be/OBf0rjpp5Hw" target="_blank"&gt;https://youtu.be/OBf0rjpp5Hw&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4" target="_blank"&gt;https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 03:03:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-consistent-customers/m-p/2686043#M80679</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-08-08T03:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: Getting consistent customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-consistent-customers/m-p/2686094#M80683</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&lt;/P&gt;
&lt;P&gt;I tried to create a sample pbix file like below.&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;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Past 3 months consistent customers count: = 
VAR _selectedcategory =
    VALUES ( Category[Category] )
VAR _pastmonthsnumberselect = 3
VAR _selectedmonthenddate =
    MAX ( 'Calendar'[End of Month] )
VAR _startdate =
    EOMONTH ( _selectedmonthenddate, - _pastmonthsnumberselect ) + 1
VAR _monthlycalendartable =
    SUMMARIZE (
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Date] &amp;lt;= _selectedmonthenddate
                &amp;amp;&amp;amp; 'Calendar'[Date] &amp;gt;= _startdate
        ),
        'Calendar'[Month-Year]
    )
VAR _newtable =
    FILTER (
        SUMMARIZE (
            ADDCOLUMNS (
                FILTER (
                    SUMMARIZE (
                        ALL ( Data ),
                        Category[Category],
                        Customer[Cust_ID],
                        'Calendar'[Month-Year]
                    ),
                    'Calendar'[Month-Year]
                        IN _monthlycalendartable
                        &amp;amp;&amp;amp; Category[Category] IN _selectedcategory
                ),
                "@amountsum", CALCULATE ( SUM ( Data[Amount] ) )
            ),
            Customer[Cust_ID],
            'Calendar'[Month-Year],
            [@amountsum]
        ),
        [@amountsum] &amp;lt;&amp;gt; 0
    )
VAR _groupbycustomer =
    FILTER (
        GROUPBY (
            _newtable,
            Customer[Cust_ID],
            "@monthcount", SUMX ( CURRENTGROUP (), 1 )
        ),
        [@monthcount] &amp;gt;= _pastmonthsnumberselect
    )
VAR _result =
    COUNTROWS ( _groupbycustomer )
RETURN
    _result + 0
&lt;/LI-CODE&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;LI-CODE lang="markup"&gt;Past 6 months consistent customers count: = 
VAR _selectedcategory =
    VALUES ( Category[Category] )
VAR _pastmonthsnumberselect = 6
VAR _selectedmonthenddate =
    MAX ( 'Calendar'[End of Month] )
VAR _startdate =
    EOMONTH ( _selectedmonthenddate, - _pastmonthsnumberselect ) + 1
VAR _monthlycalendartable =
    SUMMARIZE (
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Date] &amp;lt;= _selectedmonthenddate
                &amp;amp;&amp;amp; 'Calendar'[Date] &amp;gt;= _startdate
        ),
        'Calendar'[Month-Year]
    )
VAR _newtable =
    FILTER (
        SUMMARIZE (
            ADDCOLUMNS (
                FILTER (
                    SUMMARIZE (
                        ALL ( Data ),
                        Category[Category],
                        Customer[Cust_ID],
                        'Calendar'[Month-Year]
                    ),
                    'Calendar'[Month-Year]
                        IN _monthlycalendartable
                        &amp;amp;&amp;amp; Category[Category] IN _selectedcategory
                ),
                "@amountsum", CALCULATE ( SUM ( Data[Amount] ) )
            ),
            Customer[Cust_ID],
            'Calendar'[Month-Year],
            [@amountsum]
        ),
        [@amountsum] &amp;lt;&amp;gt; 0
    )
VAR _groupbycustomer =
    FILTER (
        GROUPBY (
            _newtable,
            Customer[Cust_ID],
            "@monthcount", SUMX ( CURRENTGROUP (), 1 )
        ),
        [@monthcount] &amp;gt;= _pastmonthsnumberselect
    )
VAR _result =
    COUNTROWS ( _groupbycustomer )
RETURN
    _result + 0&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 03:47:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-consistent-customers/m-p/2686094#M80683</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-08-08T03:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Getting consistent customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-consistent-customers/m-p/2687424#M80783</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;# Detension = 
VAR __n = MAX( SPAN[Consecutive] )
VAR __p = DATESINPERIOD( DATES[Date], MAX( DATES[Date] ), - __n, MONTH )
RETURN
    COUNTROWS(
        FILTER(
            VALUES( DATA[Cust_ID] ),
            CALCULATE( DISTINCTCOUNT( DATES[Yr-Mn] ), CALCULATETABLE( DATA, __p ) ) = __n
        )
    ) + 0&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 13:13:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-consistent-customers/m-p/2687424#M80783</guid>
      <dc:creator>CNENFRNL</dc:creator>
      <dc:date>2022-08-08T13:13:52Z</dc:date>
    </item>
  </channel>
</rss>

