<?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: Calculate The max By year For all the user in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-The-max-By-year-For-all-the-user/m-p/3974681#M154126</link>
    <description>&lt;UL&gt;&lt;LI&gt;I can't because it's some confidential data.&lt;/LI&gt;&lt;/UL&gt;</description>
    <pubDate>Wed, 05 Jun 2024 14:37:26 GMT</pubDate>
    <dc:creator>OmarSek75</dc:creator>
    <dc:date>2024-06-05T14:37:26Z</dc:date>
    <item>
      <title>Calculate The max By year For all the user</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-The-max-By-year-For-all-the-user/m-p/3974252#M154100</link>
      <description>&lt;P&gt;The first Step I calculate How many order has every user in the year.&lt;BR /&gt;Te idea here is if the user has one order or more in a month I will count as 1. Means if the user has order all the month , the resut will be 12.&lt;BR /&gt;&lt;BR /&gt;This is the formula :&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;UniqueMonthsPerYear =&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;NumberOccurencePerYear&lt;/SPAN&gt; =&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &lt;SPAN&gt;COUNTROWS&lt;/SPAN&gt; (&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;SUMMARIZE&lt;/SPAN&gt; (&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;SPAN&gt;'ft_qualityesod'&lt;/SPAN&gt;,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;'DateTable'&lt;/SPAN&gt;&lt;SPAN&gt;[MonthYear]&lt;/SPAN&gt;,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;ft_qualityesod&lt;/SPAN&gt;&lt;SPAN&gt;[user_email]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; )&lt;/DIV&gt;&lt;DIV&gt;)&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt; (&lt;SPAN&gt;ISBLANK&lt;/SPAN&gt;(&lt;SPAN&gt;NumberOccurencePerYear&lt;/SPAN&gt;),&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &lt;SPAN&gt;0&lt;/SPAN&gt;,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &lt;SPAN&gt;NumberOccurencePerYear&lt;/SPAN&gt;)&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;Then I want&amp;nbsp; to do some conditional formating , so I thought about creating a new measure where I calculate the max every year then divide the value on the max .... etc&amp;nbsp;&lt;BR /&gt;Now I have problem calculating the max , this is my formula :&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;Number Declaration Conditional formating =&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; MaxMonthsPerYear =&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;(&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &lt;SPAN&gt;MAXX&lt;/SPAN&gt;(&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;SPAN&gt;SUMMARIZE&lt;/SPAN&gt;(&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;SPAN&gt;ALL&lt;/SPAN&gt;('ft_qualityesod'),&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'DateTable'[Year],&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'ft_qualityesod'[user_email],&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;SPAN&gt;"UniqueMonths"&lt;/SPAN&gt;, [UniqueMonthsPerYear]&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ),&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [UniqueMonths]&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; )&lt;/DIV&gt;&lt;DIV&gt;)&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt; MaxMonthsPerYear&lt;BR /&gt;This is an image of result :&amp;nbsp;&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;I don't understand why I have 12 all the time, for 2024 as we are in juin , I'am supposed to have 4 (AS my dara are until Avril).&lt;/DIV&gt;&lt;DIV&gt;I need help to resolve this problem.Thanks&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 05 Jun 2024 12:20:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-The-max-By-year-For-all-the-user/m-p/3974252#M154100</guid>
      <dc:creator>OmarSek75</dc:creator>
      <dc:date>2024-06-05T12:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate The max By year For all the user</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-The-max-By-year-For-all-the-user/m-p/3974666#M154124</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="754960" data-lia-user-login="OmarSek75" class="lia-mention lia-mention-user"&gt;OmarSek75&lt;/a&gt;&amp;nbsp;Hi! Can you paste the data on which you calculate these formulas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BBF&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 14:28:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-The-max-By-year-For-all-the-user/m-p/3974666#M154124</guid>
      <dc:creator>BeaBF</dc:creator>
      <dc:date>2024-06-05T14:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate The max By year For all the user</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-The-max-By-year-For-all-the-user/m-p/3974681#M154126</link>
      <description>&lt;UL&gt;&lt;LI&gt;I can't because it's some confidential data.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 05 Jun 2024 14:37:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-The-max-By-year-For-all-the-user/m-p/3974681#M154126</guid>
      <dc:creator>OmarSek75</dc:creator>
      <dc:date>2024-06-05T14:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate The max By year For all the user</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-The-max-By-year-For-all-the-user/m-p/3976083#M154169</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="754960" data-lia-user-login="OmarSek75" class="lia-mention lia-mention-user"&gt;OmarSek75&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you used ALL, all filters are cleared. This will take the maximum value in the UniqueMonths column of the summarize virtual table. If you want to keep the year filter, you should change your DAX to:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Number Declaration Conditional formating =
var MaxMonthsPerYear =
CALCULATE(
    MAXX(
        SUMMARIZE(
            ALLEXCEPT ('ft_qualityesod','DateTable'[Year]),
            'DateTable'[Year],
            'ft_qualityesod'[user_email],
            "UniqueMonths", [UniqueMonthsPerYear]
        ),
        [UniqueMonths]
    )
)
RETURN MaxMonthsPerYear&lt;/LI-CODE&gt;
&lt;P&gt;AllEXCEPT retains the year filter so that the maximum value for each year is correctly calculated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-Get-Your-Question-Answered-Quickly%2Fba-p%2F38490&amp;amp;data=05%7C02%7Cv-jianpengli%40microsoft.com%7Cd9552f18a0c94a7564f308dc188bf35e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638412236574903368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=3jxUE%2BTNC8dS4DIhPphEB3NA%2BK94pwURGHu%2BXC4eezw%3D&amp;amp;reserved=0" target="_blank"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Jianpeng Li&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 06:14:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-The-max-By-year-For-all-the-user/m-p/3976083#M154169</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-06T06:14:31Z</dc:date>
    </item>
  </channel>
</rss>

