<?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: Count first Occurrence of Ticket by Month in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-first-Occurrence-of-Ticket-by-Month/m-p/4130394#M164054</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="799059" data-lia-user-login="Louis020790" class="lia-mention lia-mention-user"&gt;Louis020790&lt;/a&gt;&amp;nbsp;,&amp;nbsp;ahadkarimi, thank you for your prompt reply!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please create two measures as shown below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;FirstTicketMonth = CALCULATE(MIN('Table'[Year Month]),FILTER(ALL('Table'),'Table'[Product ID]=MAX('Table'[Product ID])&amp;amp;&amp;amp;'Table'[Ticket Type ID]=1))&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;IsCount = IF(MONTH([FirstTicketMonth])&amp;lt;=8 &amp;amp;&amp;amp; YEAR([FirstTicketMonth])=2024&amp;amp;&amp;amp; MAX('Table'[Ticket Type ID])=1&amp;amp;&amp;amp; [FirstTicketMonth]=MAX('Table'[Year Month]),"Yes","No")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result for your reference:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Joyce&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Sep 2024 05:09:00 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-09-03T05:09:00Z</dc:date>
    <item>
      <title>Count first Occurrence of Ticket by Month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-first-Occurrence-of-Ticket-by-Month/m-p/4125336#M163813</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wondering if you can help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have a model that is used by multiple users so would like to create this as a measure (no calc columns or power Query changes).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Scenario: We have tickets that can be created against our products.&lt;/P&gt;&lt;P&gt;The user would like a YTD chart by month for the current year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The user would like to count the first occurrence of a specific ticket type (type ID 1) being raised against an product.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Multiple occurrences of the same ticket type can be raised against one product.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the first occurence was outside of current YTD, then no tickets should be counted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Current YTD assumed to be 2024 Jan - Aug.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought I could get there using ADDCOLUMNS and adding a ranking column.&amp;nbsp;&lt;BR /&gt;I added the rank column but unsure how to use that added column to then restrict the results.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Image showing data structure below.&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 15:44:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-first-Occurrence-of-Ticket-by-Month/m-p/4125336#M163813</guid>
      <dc:creator>Louis020790</dc:creator>
      <dc:date>2024-08-29T15:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Count first Occurrence of Ticket by Month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-first-Occurrence-of-Ticket-by-Month/m-p/4125439#M163822</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="799059" data-lia-user-login="Louis020790" class="lia-mention lia-mention-user"&gt;Louis020790&lt;/a&gt;, try this measure below, and if you encounter any issues, let me know.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;FirstOccurrenceCountYTD = 
VAR CurrentYear = 2024
VAR YTDEndMonth = 8
VAR FilteredTable = 
    FILTER(
        'TableName', 
        'TableName'[Ticket Type ID] = 1 &amp;amp;&amp;amp;
        YEAR('TableName'[Year Month]) = CurrentYear &amp;amp;&amp;amp;
        MONTH('TableName'[Year Month]) &amp;lt;= YTDEndMonth
    )
VAR MinYearMonthTable = 
    ADDCOLUMNS(
        SUMMARIZE(
            FilteredTable, 
            'TableName'[Product ID]
        ),
        "MinYearMonth", MINX(
            CALCULATETABLE(
                FilteredTable, 
                ALLEXCEPT('TableName', 'TableName'[Product ID])
            ),
            'TableName'[Year Month]
        )
    )
RETURN
    COUNTROWS(
        FILTER(
            MinYearMonthTable,
            'TableName'[MinYearMonth] &amp;lt;= (CurrentYear * 100 + YTDEndMonth)
        )
    )&lt;/LI-CODE&gt;&lt;P align="center"&gt;&lt;FONT face="verdana,geneva"&gt;&lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;Did I answer your question?&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;If so, please mark my post as the solution! &lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="verdana,geneva"&gt;&lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;Your Kudos are much appreciated!&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;Proud to be a Solution Supplier!&lt;/STRONG&gt;&lt;/FONT&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 17:22:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-first-Occurrence-of-Ticket-by-Month/m-p/4125439#M163822</guid>
      <dc:creator>ahadkarimi</dc:creator>
      <dc:date>2024-08-29T17:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Count first Occurrence of Ticket by Month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-first-Occurrence-of-Ticket-by-Month/m-p/4130394#M164054</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="799059" data-lia-user-login="Louis020790" class="lia-mention lia-mention-user"&gt;Louis020790&lt;/a&gt;&amp;nbsp;,&amp;nbsp;ahadkarimi, thank you for your prompt reply!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please create two measures as shown below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;FirstTicketMonth = CALCULATE(MIN('Table'[Year Month]),FILTER(ALL('Table'),'Table'[Product ID]=MAX('Table'[Product ID])&amp;amp;&amp;amp;'Table'[Ticket Type ID]=1))&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;IsCount = IF(MONTH([FirstTicketMonth])&amp;lt;=8 &amp;amp;&amp;amp; YEAR([FirstTicketMonth])=2024&amp;amp;&amp;amp; MAX('Table'[Ticket Type ID])=1&amp;amp;&amp;amp; [FirstTicketMonth]=MAX('Table'[Year Month]),"Yes","No")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result for your reference:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Joyce&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 05:09:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-first-Occurrence-of-Ticket-by-Month/m-p/4130394#M164054</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-09-03T05:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: Count first Occurrence of Ticket by Month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-first-Occurrence-of-Ticket-by-Month/m-p/4211813#M166989</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the proposal, but this doesn't work.&amp;nbsp;&lt;BR /&gt;No results returned in my test dataset.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I alos removed Ticket Type to simplify further and counted all records of table&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;</description>
      <pubDate>Wed, 02 Oct 2024 10:35:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-first-Occurrence-of-Ticket-by-Month/m-p/4211813#M166989</guid>
      <dc:creator>Louis020790</dc:creator>
      <dc:date>2024-10-02T10:35:12Z</dc:date>
    </item>
  </channel>
</rss>

