<?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: Cohort Analysis average in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cohort-Analysis-average/m-p/3337628#M125189</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="490626" data-lia-user-login="TheProv" class="lia-mention lia-mention-user"&gt;TheProv&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To calculate the average for each month after the join month, you can create a new measure that calculates the average of the "Customers in cohort %" measure for each month. Here's a DAX measure that should help you achieve this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Average Customers in Cohort % =
VAR MaxMonthAfter = MAX('Cohort Analisys'[Value])
VAR Result =
    AVERAGEX(
        FILTER(
            ALL('Cohort Analisys'[Value]),
            'Cohort Analisys'[Value] &amp;lt;= MaxMonthAfter
        ),
        CALCULATE(
            [Customers in cohort %],
            ALLEXCEPT('Users'' Revenues &amp;amp; Active Months', 'Users'' Revenues &amp;amp; Active Months'[Join month])
        )
    )
RETURN
    Result&lt;/LI-CODE&gt;
&lt;P&gt;If the above one can't help you get the desired result, please provide some&amp;nbsp;&lt;STRONG&gt;sample data&lt;/STRONG&gt;&amp;nbsp;in your tables (&lt;STRONG&gt;exclude&amp;nbsp;sensitive&amp;nbsp;data&lt;/STRONG&gt;) with&amp;nbsp;&lt;STRONG&gt;Text&lt;/STRONG&gt;&amp;nbsp;format and your&amp;nbsp;&lt;STRONG&gt;expected result&lt;/STRONG&gt;&amp;nbsp;with backend logic and special examples.&amp;nbsp;&lt;STRONG&gt;It is better&lt;/STRONG&gt;&amp;nbsp;if you can share a&amp;nbsp;&lt;STRONG&gt;simplified&lt;/STRONG&gt;&amp;nbsp;pbix file.&amp;nbsp;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post  &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution &lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jul 2023 03:01:21 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-07-19T03:01:21Z</dc:date>
    <item>
      <title>Cohort Analysis average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cohort-Analysis-average/m-p/3334588#M125044</link>
      <description>&lt;P&gt;Hi, I am analyzing a subscription service and I am trying to determine the average for the cohort analysis I have implemented.&lt;BR /&gt;I have a subscriptions table that looks as follows:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I determined the join month of a user in another table and generated the following measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Customers in cohort % = 
VAR CurrentMonthAfter = SELECTEDVALUE('Cohort Analisys'[Value])
VAR CurrentFirstOrderMonth = SELECTEDVALUE('Users'' Revenues &amp;amp; Active Months'[Join month])
VAR _EOMonth = EOMONTH(CurrentFirstOrderMonth, CurrentMonthAfter)

Return
DIVIDE(
    Calculate(
        DISTINCTCOUNT('subscriptions'[user_id]),
    Filter(
        'subscriptions',
        'subscriptions'[created_at] &amp;lt; _EOMonth &amp;amp;&amp;amp; ('subscriptions'[ends_at] = BLANK() || 'subscriptions'[ends_at] &amp;gt; _EOMonth) &amp;amp;&amp;amp; _EOMonth &amp;lt; TODAY()
    )
    ),
    DISTINCTCOUNT('subscriptions'[user_id])
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Now, the end result is something like this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Now, instead of having the join month to build the rows, I'd love to have a single row with the average for the first, second, third month and so on.&lt;BR /&gt;&lt;BR /&gt;Had trouble interpreting other's solution as I'm not a DAX pro.&lt;BR /&gt;Thanks in advance for anyone spending time on this!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 14:26:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cohort-Analysis-average/m-p/3334588#M125044</guid>
      <dc:creator>TheProv</dc:creator>
      <dc:date>2023-07-17T14:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: Cohort Analysis average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cohort-Analysis-average/m-p/3337628#M125189</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="490626" data-lia-user-login="TheProv" class="lia-mention lia-mention-user"&gt;TheProv&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To calculate the average for each month after the join month, you can create a new measure that calculates the average of the "Customers in cohort %" measure for each month. Here's a DAX measure that should help you achieve this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Average Customers in Cohort % =
VAR MaxMonthAfter = MAX('Cohort Analisys'[Value])
VAR Result =
    AVERAGEX(
        FILTER(
            ALL('Cohort Analisys'[Value]),
            'Cohort Analisys'[Value] &amp;lt;= MaxMonthAfter
        ),
        CALCULATE(
            [Customers in cohort %],
            ALLEXCEPT('Users'' Revenues &amp;amp; Active Months', 'Users'' Revenues &amp;amp; Active Months'[Join month])
        )
    )
RETURN
    Result&lt;/LI-CODE&gt;
&lt;P&gt;If the above one can't help you get the desired result, please provide some&amp;nbsp;&lt;STRONG&gt;sample data&lt;/STRONG&gt;&amp;nbsp;in your tables (&lt;STRONG&gt;exclude&amp;nbsp;sensitive&amp;nbsp;data&lt;/STRONG&gt;) with&amp;nbsp;&lt;STRONG&gt;Text&lt;/STRONG&gt;&amp;nbsp;format and your&amp;nbsp;&lt;STRONG&gt;expected result&lt;/STRONG&gt;&amp;nbsp;with backend logic and special examples.&amp;nbsp;&lt;STRONG&gt;It is better&lt;/STRONG&gt;&amp;nbsp;if you can share a&amp;nbsp;&lt;STRONG&gt;simplified&lt;/STRONG&gt;&amp;nbsp;pbix file.&amp;nbsp;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post  &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution &lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 03:01:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cohort-Analysis-average/m-p/3337628#M125189</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-07-19T03:01:21Z</dc:date>
    </item>
  </channel>
</rss>

