<?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: Recalculate max based on filters in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Recalculate-max-based-on-filters/m-p/1384682#M25321</link>
    <description>&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 21 Sep 2020 13:50:12 GMT</pubDate>
    <dc:creator>mateoc15</dc:creator>
    <dc:date>2020-09-21T13:50:12Z</dc:date>
    <item>
      <title>Recalculate max based on filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Recalculate-max-based-on-filters/m-p/1384678#M25320</link>
      <description>&lt;P&gt;I am trying to create a gauge that shows the current week vs. the 13 week maximum. If in the last 13 weeks the maximum weekly value is 20 and the current week is 15 then the gauge would be 75% "full". It's working as expected until I apply filters. The value is filtered correctly, but the 13 week maximum is not recalculating. Here's what I'm currently using that is problematic:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Visitors - Weekly Max All Time = 
MAXX(
   SUMMARIZE(ALL('Traffic'), 
   'Date'[Week Of], 
   "DistinctCookie", 
   DISTINCTCOUNT(Traffic[cookie_id])), 
[DistinctCookie])&lt;/LI-CODE&gt;&lt;P&gt;I tried this ALLEXCEPT filter but it behaves the same:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Visitors - Weekly Max All Time = 
MAXX(
    SUMMARIZE(ALL('Traffic'), 
    'Date'[Week Of], 
    "DistinctCookie", 
    CALCULATE(DISTINCTCOUNT(Traffic[cookie_id]), ALLEXCEPT('Traffic', 'Date'[Week Of]))), [DistinctCookie])&lt;/LI-CODE&gt;&lt;P&gt;Placing the ALLEXCEPT as the first parameter of the SUMMARIZE doesn't seem to work either.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Any help appreciated. Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2020 13:53:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Recalculate-max-based-on-filters/m-p/1384678#M25320</guid>
      <dc:creator>mateoc15</dc:creator>
      <dc:date>2020-09-21T13:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Recalculate max based on filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Recalculate-max-based-on-filters/m-p/1384682#M25321</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2020 13:50:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Recalculate-max-based-on-filters/m-p/1384682#M25321</guid>
      <dc:creator>mateoc15</dc:creator>
      <dc:date>2020-09-21T13:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Recalculate max based on filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Recalculate-max-based-on-filters/m-p/1384784#M25323</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="232022" data-lia-user-login="mateoc15" class="lia-mention lia-mention-user"&gt;mateoc15&lt;/a&gt; , You need rolling 91 Days or 13 weeks for week you can week rank in table have measure like given below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;column in date table&lt;/P&gt;
&lt;P&gt;Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;measures &lt;BR /&gt;This Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))&lt;BR /&gt;Last Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))&lt;BR /&gt;Last year Week= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=(max('Date'[Week Rank]) -52)))&lt;BR /&gt;Last 13 weeks = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]&amp;gt;=max('Date'[Week Rank])-13 &amp;amp;&amp;amp; 'Date'[Week Rank]&amp;lt;=max('Date'[Week Rank])))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;refer my blogs if they can help&lt;/P&gt;
&lt;P&gt;&lt;A href="https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3" target="_blank"&gt;https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2020 14:28:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Recalculate-max-based-on-filters/m-p/1384784#M25323</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-09-21T14:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Recalculate max based on filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Recalculate-max-based-on-filters/m-p/1384810#M25324</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;Maybe I wasn't clear, I'm sorry.&amp;nbsp; The date is not the problem.&amp;nbsp; I have that figured out via a "Week Of in the last 13 calendar weeks" filter (which the user can't change).&amp;nbsp; The problem is the measure for the max value.&amp;nbsp; The 1.09M is total for all records, but if I filter on any dimension in the Traffic table I want it to recalculate the max value, applying that filter across the board.&amp;nbsp; Suppose the filter is favorite color.&amp;nbsp; If I select blue, and if the maximum weekly value is only 300k people with a favorite color of blue, then the high end of the gauge should show 300k and the value should show however many people have a favorite color of blue in the current week (maybe 250k or something as an example).&amp;nbsp; These filters are user-selected, not via DAX.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2020 14:40:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Recalculate-max-based-on-filters/m-p/1384810#M25324</guid>
      <dc:creator>mateoc15</dc:creator>
      <dc:date>2020-09-21T14:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Recalculate max based on filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Recalculate-max-based-on-filters/m-p/1385095#M25328</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="232022" data-lia-user-login="mateoc15" class="lia-mention lia-mention-user"&gt;mateoc15&lt;/a&gt; , Allexpect will not work with summarize. You can use addcolumn on top summarize to make it work &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or try like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Visitors - Weekly Max All Time = &lt;BR /&gt;MAXX(values('Date'[Week Of]) ,&lt;BR /&gt;CALCULATE(DISTINCTCOUNT(Traffic[cookie_id]), ALLEXCEPT('Traffic', 'Date'[Week Of])))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2020 16:53:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Recalculate-max-based-on-filters/m-p/1385095#M25328</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-09-21T16:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: Recalculate max based on filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Recalculate-max-based-on-filters/m-p/1385205#M25329</link>
      <description>&lt;P&gt;I finally got it.&amp;nbsp; Although I'm still not 100% sure why, this works, based on some unrelated tinkering with &lt;A href="https://www.sqlbi.com/articles/best-practices-using-summarize-and-addcolumns/" target="_self"&gt;this&lt;/A&gt; article about ADDCOLUMNS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The old max value calculation:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Visitors - Weekly Max All Time = 
    MAXX(
        SUMMARIZE(
                ALL('Traffic'), 
                'Date'[Week Of],
                "DistinctCookie", 
            DISTINCTCOUNT(Traffic[cookie_id])),
    [DistinctCookie])
    &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The new max value calculation:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Visitors - Weekly Max All Time = 
    MAXX(
        ADDCOLUMNS(
            SUMMARIZE(
                ALL('Traffic'), 
                'Date'[Week Of]),
            "DistinctCookie", 
            CALCULATE(DISTINCTCOUNT(Traffic[cookie_id]))),
    [DistinctCookie])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The scope/context of the SUMMARIZE is just different, and a CALCULATE without a second parameter.&lt;BR /&gt;&lt;BR /&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;Maybe you can help explain why it makes a difference?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's also important to note that any date filters must be on the "Week Of" value from the Date table, not any other field such as the exact date or month, etc.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2020 18:24:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Recalculate-max-based-on-filters/m-p/1385205#M25329</guid>
      <dc:creator>mateoc15</dc:creator>
      <dc:date>2020-09-21T18:24:25Z</dc:date>
    </item>
  </channel>
</rss>

