<?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: Please HELP Count skips occurrences in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Please-HELP-Count-skips-occurrences/m-p/2499648#M69078</link>
    <description>&lt;P&gt;I have another quick question.&lt;/P&gt;&lt;P&gt;I want to use this code and CREATE SECOND Column but use filter from another table, but I&amp;nbsp;received&amp;nbsp;below error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;&lt;EM&gt;A single value for column 'YEARMONTH' in table 'Enrollment' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;Here is the updated code:&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;LI-CODE lang="css"&gt;Active_records_last_22_months = 
VAR _GP = 'CLAIM'[GP]
VAR _YRMO = 'CLAIM'[YEARMONTH]
VAR _id = 'CLAIM'[ID]
VAR end_date = 'CLAIM'[start_date]
VAR start_date =
    EOMONTH ( end_date, -23 ) + 1
VAR count_occurences =
    RANKX (
        FILTER (
            'Enrollment',
            'Enrollment'[GP] = _GP
                &amp;amp;&amp;amp; 'Enrollment'[ID] = _id
                &amp;amp;&amp;amp; 'Enrollment'[start_date] &amp;gt;= start_date
                &amp;amp;&amp;amp; 'Enrollment'[start_date] &amp;lt;= end_date
        ),
        Enrollment[YEARMONTH],
        ,
        ASC,
        Dense
    )
RETURN
    count_occurences&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;</description>
    <pubDate>Sat, 07 May 2022 04:09:52 GMT</pubDate>
    <dc:creator>NilR</dc:creator>
    <dc:date>2022-05-07T04:09:52Z</dc:date>
    <item>
      <title>Please HELP Count skips occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Please-HELP-Count-skips-occurrences/m-p/2499268#M69056</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a count Calculated Column that skips numbers if there are more than one YearMonth Value. Do you have any better suggestion?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="css"&gt;Active_records_last_22_months = 
VAR _GP='Enrollment'[GP]
VAR _YRMO='Enrollment'[YEARMONTH]
var _id = 'Enrollment'[ID]
var end_date = 'Enrollment'[start_date]
var start_date = EOMONTH(end_date,-23)+1

var count_occurences = 
CALCULATE(COUNT ('Enrollment'[YEARMONTH]),
        FILTER('Enrollment', 
        'Enrollment'[GP]= _GP &amp;amp;&amp;amp;
        'Enrollment'[ID]=_id &amp;amp;&amp;amp;
         'Enrollment'[start_date] &amp;gt;= start_date &amp;amp;&amp;amp;
          'Enrollment'[start_date] &amp;lt;=end_date))

return
count_occurences&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;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 21:24:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Please-HELP-Count-skips-occurrences/m-p/2499268#M69056</guid>
      <dc:creator>NilR</dc:creator>
      <dc:date>2022-05-06T21:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: Please HELP Count skips occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Please-HELP-Count-skips-occurrences/m-p/2499577#M69067</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="261788" data-lia-user-login="NilR" class="lia-mention lia-mention-user"&gt;NilR&lt;/a&gt; , Try dense Rank&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A new column&lt;/P&gt;
&lt;P&gt;Rankx(Table, [YearMonth],,asc,dense)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For Rank Refer these links&lt;BR /&gt;&lt;A href="https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns" target="_blank"&gt;https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 May 2022 01:10:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Please-HELP-Count-skips-occurrences/m-p/2499577#M69067</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-05-07T01:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Please HELP Count skips occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Please-HELP-Count-skips-occurrences/m-p/2499580#M69068</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="261788" data-lia-user-login="NilR" class="lia-mention lia-mention-user"&gt;NilR&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A small change to your existing code that would fix it would be to change &lt;STRONG&gt;COUNT&lt;/STRONG&gt; to &lt;STRONG&gt;DISTINCTCOUNT&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If performance is a concern, you may want to consider using RANKX as discussed in the article&lt;/P&gt;
&lt;P&gt;&lt;A title="How to compute index numbers at top speed" href="https://www.sqlbi.com/articles/how-to-compute-index-numbers-at-top-speed/" target="_blank" rel="noopener"&gt;How to compute index numbers at top speed.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are a couple of options using RANKX:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Active_records_last_22_months = 
VAR end_date = 'Enrollment'[start_date]
VAR start_date =
    EOMONTH ( end_date, -23 ) + 1
VAR count_occurences =
    RANKX (
        CALCULATETABLE (
            VALUES ( 'Enrollment'[YEARMONTH] ),
            ALLEXCEPT ( Enrollment, Enrollment[GP], Enrollment[ID] ),
            'Enrollment'[start_date] &amp;gt;= start_date &amp;amp;&amp;amp; 'Enrollment'[start_date] &amp;lt;= end_date
        ),
        Enrollment[YEARMONTH],
        ,
        ASC
    )
RETURN
    count_occurences&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Active_records_last_22_months = 
VAR _GP = 'Enrollment'[GP]
VAR _YRMO = 'Enrollment'[YEARMONTH]
VAR _id = 'Enrollment'[ID]
VAR end_date = 'Enrollment'[start_date]
VAR start_date =
    EOMONTH ( end_date, -23 ) + 1
VAR count_occurences =
    RANKX (
        FILTER (
            'Enrollment',
            'Enrollment'[GP] = _GP
                &amp;amp;&amp;amp; 'Enrollment'[ID] = _id
                &amp;amp;&amp;amp; 'Enrollment'[start_date] &amp;gt;= start_date
                &amp;amp;&amp;amp; 'Enrollment'[start_date] &amp;lt;= end_date
        ),
        Enrollment[YEARMONTH],
        ,
        ASC,
        Dense
    )
RETURN
    count_occurences&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Owen&lt;/P&gt;</description>
      <pubDate>Sat, 07 May 2022 01:18:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Please-HELP-Count-skips-occurrences/m-p/2499580#M69068</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2022-05-07T01:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: Please HELP Count skips occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Please-HELP-Count-skips-occurrences/m-p/2499620#M69073</link>
      <description>&lt;P&gt;It was brilliant&amp;nbsp;! Thank you!!&lt;/P&gt;</description>
      <pubDate>Sat, 07 May 2022 02:48:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Please-HELP-Count-skips-occurrences/m-p/2499620#M69073</guid>
      <dc:creator>NilR</dc:creator>
      <dc:date>2022-05-07T02:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Please HELP Count skips occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Please-HELP-Count-skips-occurrences/m-p/2499648#M69078</link>
      <description>&lt;P&gt;I have another quick question.&lt;/P&gt;&lt;P&gt;I want to use this code and CREATE SECOND Column but use filter from another table, but I&amp;nbsp;received&amp;nbsp;below error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;&lt;EM&gt;A single value for column 'YEARMONTH' in table 'Enrollment' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;Here is the updated code:&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;LI-CODE lang="css"&gt;Active_records_last_22_months = 
VAR _GP = 'CLAIM'[GP]
VAR _YRMO = 'CLAIM'[YEARMONTH]
VAR _id = 'CLAIM'[ID]
VAR end_date = 'CLAIM'[start_date]
VAR start_date =
    EOMONTH ( end_date, -23 ) + 1
VAR count_occurences =
    RANKX (
        FILTER (
            'Enrollment',
            'Enrollment'[GP] = _GP
                &amp;amp;&amp;amp; 'Enrollment'[ID] = _id
                &amp;amp;&amp;amp; 'Enrollment'[start_date] &amp;gt;= start_date
                &amp;amp;&amp;amp; 'Enrollment'[start_date] &amp;lt;= end_date
        ),
        Enrollment[YEARMONTH],
        ,
        ASC,
        Dense
    )
RETURN
    count_occurences&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;</description>
      <pubDate>Sat, 07 May 2022 04:09:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Please-HELP-Count-skips-occurrences/m-p/2499648#M69078</guid>
      <dc:creator>NilR</dc:creator>
      <dc:date>2022-05-07T04:09:52Z</dc:date>
    </item>
  </channel>
</rss>

