<?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: Rolling 12 month % average and 5 month % average of each Category in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-12-month-average-and-5-month-average-of-each-Category/m-p/4346068#M172597</link>
    <description>&lt;P&gt;Thanks for the reply from&amp;nbsp;lbendlin.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="659067" data-lia-user-login="NG1407" class="lia-mention lia-mention-user"&gt;NG1407&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the data you provided, I created the following measures:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ActiveCountpast5months = 
VAR TodayDate =
    TODAY ()
VAR Past10thDates =
    ADDCOLUMNS (
        CALENDAR ( EDATE ( TodayDate, -5 ), TodayDate ),
        "Month10th", DATE ( YEAR ( [Date] ), MONTH ( [Date] ), 10 )
    )
RETURN
    SUMX (
        'Table',
        IF (
            COUNTROWS (
                FILTER (
                    Past10thDates,
                    DAY ( [Month10th] ) = 10
                        &amp;amp;&amp;amp; [Month10th] &amp;gt;= 'Table'[Startdate]
                        &amp;amp;&amp;amp; [Month10th] &amp;lt;= 'Table'[Enddate]
                )
            ) &amp;gt; 0,
            1
        )
    )
&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;%5months average = 
DIVIDE ( [ActiveCountpast5months], COUNTROWS ( ALL ( 'Table' ) ) )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;ActiveCountpast12months = 
VAR TodayDate =
    TODAY ()
VAR Past10thDates =
    ADDCOLUMNS (
        CALENDAR ( EDATE ( TodayDate, -12 ), TodayDate ),
        "Month10th", DATE ( YEAR ( [Date] ), MONTH ( [Date] ), 10 )
    )
RETURN
    SUMX (
        'Table',
        IF (
            COUNTROWS (
                FILTER (
                    Past10thDates,
                    DAY ( [Month10th] ) = 10
                        &amp;amp;&amp;amp; [Month10th] &amp;gt;= 'Table'[Startdate]
                        &amp;amp;&amp;amp; [Month10th] &amp;lt;= 'Table'[Enddate]
                )
            ) &amp;gt; 0,
            1
        )
    )
&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;%12months average = 
DIVIDE ( [ActiveCountpast12months], COUNTROWS ( ALL ( 'Table' ) ) )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Zhu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;I&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/I&gt;, then please consider&amp;nbsp;&lt;I&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/I&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 30 Dec 2024 09:08:00 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-12-30T09:08:00Z</dc:date>
    <item>
      <title>Rolling 12 month % average and 5 month % average of each Category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-12-month-average-and-5-month-average-of-each-Category/m-p/4338885#M172294</link>
      <description>&lt;P&gt;I am calculating the count of only those ID that has startdate &amp;lt;= 10 and enddate &amp;gt; 10 for each month . In other words need to find count of ID that are active till current selected month. A record is active if its enddate is greater than 10th of that month.&lt;/P&gt;&lt;P&gt;For example for jan month I need to count all those ID that has startdate less than or equal to 10thjan and startdate should contain dates from previous month as well that has end date &amp;gt; 10thjan or in future).&lt;/P&gt;&lt;P&gt;below is the sample data :&lt;/P&gt;&lt;P&gt;Startdate enddate ID&lt;BR /&gt;2024-01-10 2024-12-01 a123&lt;BR /&gt;2023-12-11 2024-01-11 b123&lt;BR /&gt;2024-01-02 2024-11-08 c123&lt;BR /&gt;2024-02-11 2024-02-28 d123&lt;BR /&gt;2024-03-03 2024-03-10 e123&lt;BR /&gt;2024-03-03 2024-03-15 f123&lt;BR /&gt;According to above data for jan month the count should be 3, for feb month count should be 0,for march its 1.&lt;BR /&gt;Below is the measure I used to calculate count&lt;BR /&gt;Num active =&lt;BR /&gt;VAR CurrentMonth =&lt;BR /&gt;MAX ( 'Date'[Date] )&lt;BR /&gt;VAR CutOffDate =&lt;BR /&gt;DATE ( YEAR ( CurrentMonth ), MONTH ( CurrentMonth ), 10 )&lt;BR /&gt;VAR Result =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;DISTINCTCOUNT ( 'Table'[ID] ),&lt;BR /&gt;'Table'[Start date] &amp;lt;= CutOffDate,&lt;BR /&gt;'Table'[End date] &amp;gt; CutOffDate&lt;BR /&gt;|| ISBLANK ( 'Table'[End date] ),&lt;BR /&gt;REMOVEFILTERS ( 'Date' )&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;Result&lt;/P&gt;&lt;P&gt;After calculating count of IDs based on start date and end date Now I need further help , I need to calculate percentage average for latest 12 months and 5 months for each category and display in columns as below&lt;/P&gt;&lt;P&gt;Category&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12month % average&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5 month %age average&lt;BR /&gt;A&lt;BR /&gt;B&lt;BR /&gt;C&lt;BR /&gt;Example for category A below is the logic&lt;BR /&gt;monthlyPercentage = selected month count/totalcount&lt;BR /&gt;%age average = sum (monthly percentage of latest 12 months) /12&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 14:44:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-12-month-average-and-5-month-average-of-each-Category/m-p/4338885#M172294</guid>
      <dc:creator>NG1407</dc:creator>
      <dc:date>2024-12-20T14:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling 12 month % average and 5 month % average of each Category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-12-month-average-and-5-month-average-of-each-Category/m-p/4339018#M172298</link>
      <description>&lt;P&gt;Please provide sample data &lt;STRONG&gt;that fully covers your issue&lt;/STRONG&gt;.&lt;BR /&gt;Please show the expected outcome based on the sample data you provided.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 16:59:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-12-month-average-and-5-month-average-of-each-Category/m-p/4339018#M172298</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-12-20T16:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling 12 month % average and 5 month % average of each Category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-12-month-average-and-5-month-average-of-each-Category/m-p/4346068#M172597</link>
      <description>&lt;P&gt;Thanks for the reply from&amp;nbsp;lbendlin.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="659067" data-lia-user-login="NG1407" class="lia-mention lia-mention-user"&gt;NG1407&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the data you provided, I created the following measures:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ActiveCountpast5months = 
VAR TodayDate =
    TODAY ()
VAR Past10thDates =
    ADDCOLUMNS (
        CALENDAR ( EDATE ( TodayDate, -5 ), TodayDate ),
        "Month10th", DATE ( YEAR ( [Date] ), MONTH ( [Date] ), 10 )
    )
RETURN
    SUMX (
        'Table',
        IF (
            COUNTROWS (
                FILTER (
                    Past10thDates,
                    DAY ( [Month10th] ) = 10
                        &amp;amp;&amp;amp; [Month10th] &amp;gt;= 'Table'[Startdate]
                        &amp;amp;&amp;amp; [Month10th] &amp;lt;= 'Table'[Enddate]
                )
            ) &amp;gt; 0,
            1
        )
    )
&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;%5months average = 
DIVIDE ( [ActiveCountpast5months], COUNTROWS ( ALL ( 'Table' ) ) )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;ActiveCountpast12months = 
VAR TodayDate =
    TODAY ()
VAR Past10thDates =
    ADDCOLUMNS (
        CALENDAR ( EDATE ( TodayDate, -12 ), TodayDate ),
        "Month10th", DATE ( YEAR ( [Date] ), MONTH ( [Date] ), 10 )
    )
RETURN
    SUMX (
        'Table',
        IF (
            COUNTROWS (
                FILTER (
                    Past10thDates,
                    DAY ( [Month10th] ) = 10
                        &amp;amp;&amp;amp; [Month10th] &amp;gt;= 'Table'[Startdate]
                        &amp;amp;&amp;amp; [Month10th] &amp;lt;= 'Table'[Enddate]
                )
            ) &amp;gt; 0,
            1
        )
    )
&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;%12months average = 
DIVIDE ( [ActiveCountpast12months], COUNTROWS ( ALL ( 'Table' ) ) )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Zhu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;I&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/I&gt;, then please consider&amp;nbsp;&lt;I&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/I&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2024 09:08:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-12-month-average-and-5-month-average-of-each-Category/m-p/4346068#M172597</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-30T09:08:00Z</dc:date>
    </item>
  </channel>
</rss>

