<?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: Finding a MAX value of a summarized table in DAX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-a-MAX-value-of-a-summarized-table-in-DAX/m-p/4367444#M173396</link>
    <description>&lt;P&gt;I'm glad it worked &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You certainly can reference a summarized table if you like. I tend to avoid this approach where possible because the summarized table is materialized in memory when the measure is evaluated, which will have an impact on performance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Firstly, a couple of things to note:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;In general you should not add extended columns with the &lt;STRONG&gt;SUMMARIZE&lt;/STRONG&gt; function itself. Instead, use &lt;STRONG&gt;ADDCOLUMNS&lt;/STRONG&gt; ( &lt;STRONG&gt;SUMMARIZE&lt;/STRONG&gt; ( ... ) ). See &lt;A href="https://www.sqlbi.com/articles/best-practices-using-summarize-and-addcolumns/" target="_blank" rel="noopener"&gt;this article&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;When using &lt;STRONG&gt;ADDCOLUMNS/SUMMARIZE&lt;/STRONG&gt;, the extended column expressions must be wrapped in CALCULATE (context transition).&lt;/LI&gt;
&lt;LI&gt;If there is a single grouping column specified within &lt;STRONG&gt;SUMMARIZE&lt;/STRONG&gt; and it is from the same table as the first argument, you can just use &lt;STRONG&gt;VALUES&lt;/STRONG&gt;&amp;nbsp;with a single column argument (if there are no extended columns).&lt;BR /&gt;In other words, &lt;STRONG&gt;SUMMARIZE ( tbl, tbl[col] )&lt;/STRONG&gt; and &lt;STRONG&gt;VALUES ( tbl[col] )&lt;/STRONG&gt; are equivalent.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Taking the above into account, you could write your measure as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Max Time per Agent =
VAR AgentTime =
    ADDCOLUMNS (
        VALUES ( 'f_call Metrics'[Agent] ), -- or SUMMARIZE ( 'f_call Metrics', 'f_call Metrics'[Agent] )
        "AVG Talk Time",
        CALCULATE ( AVERAGE ( 'f_Call Metrics'[Average Handle Time] ) )
    )
VAR MaxAgentTime =
    MAXX ( AgentTime, [AVG Talk Time] )
RETURN
    MaxAgentTime&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you did want to use &lt;STRONG&gt;SUMMARIZE&lt;/STRONG&gt; itself to add columns (though I would not recommend this), it would look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Max Time per Agent =
VAR AgentTime =
    SUMMARIZE (
        'f_call Metrics',
        'f_call Metrics'[Agent],
        "AVG Talk Time",
        AVERAGE ( 'f_Call Metrics'[Average Handle Time] ) -- CALCULATE not required
    )
VAR MaxAgentTime =
    MAXX ( AgentTime, [AVG Talk Time] )
RETURN
    MaxAgentTime&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In both cases, you don't have to create the &lt;STRONG&gt;AgentTime&lt;/STRONG&gt; variable. You could just move the &lt;STRONG&gt;AgentTime&lt;/STRONG&gt; expression inside &lt;STRONG&gt;MAXX&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jan 2025 14:04:54 GMT</pubDate>
    <dc:creator>OwenAuger</dc:creator>
    <dc:date>2025-01-16T14:04:54Z</dc:date>
    <item>
      <title>Finding a MAX value of a summarized table in DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-a-MAX-value-of-a-summarized-table-in-DAX/m-p/4366101#M173363</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;I have the following DAX which resulted in the table below. I would like to see a result showing the max value in the summarized table. I attempted to wrap it in MAX, MAXX, and alternatively store the MAX'd table in a separate variable and then return that but failed.&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Min Talk Time =
    VAR ct_TalkTime = SUMMARIZE('f_Call Metrics','f_Call Metrics'[Agent], "AVG Talk Time", AVERAGE('f_Call Metrics'[Average Handle Time]))
RETURN
    ct_TalkTime &lt;/LI-CODE&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;&lt;LI-CODE lang="markup"&gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Agent&lt;/TD&gt;&lt;TD&gt;AVG Talk Time&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Aubriella Maddox&lt;/TD&gt;&lt;TD&gt;0.008394&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Connor Oliver&lt;/TD&gt;&lt;TD&gt;0.008659&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Luke Rosales&lt;/TD&gt;&lt;TD&gt;0.010166&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Jocelyn Vazquez&lt;/TD&gt;&lt;TD&gt;0.008448&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Esme Mullen&lt;/TD&gt;&lt;TD&gt;0.007051&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Sara Evans&lt;/TD&gt;&lt;TD&gt;0.00831&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Elias Marshall&lt;/TD&gt;&lt;TD&gt;0.012287&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Donovan Christian&lt;/TD&gt;&lt;TD&gt;0.008265&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 02:29:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-a-MAX-value-of-a-summarized-table-in-DAX/m-p/4366101#M173363</guid>
      <dc:creator>hobosapien</dc:creator>
      <dc:date>2025-01-16T02:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Finding a MAX value of a summarized table in DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-a-MAX-value-of-a-summarized-table-in-DAX/m-p/4366156#M173366</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="652616" data-lia-user-login="hobosapien" class="lia-mention lia-mention-user"&gt;hobosapien&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is how I would suggest writing a measure &lt;STRONG&gt;Max time per Agent&lt;/STRONG&gt;&amp;nbsp;to return the max value of the average of &lt;STRONG&gt;Average Handle Time&lt;/STRONG&gt; per agent:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Max Time per Agent =
MAXX (
    VALUES ( 'f_call Metrics'[Agent] ),
    CALCULATE ( AVERAGE( 'f_Call Metrics'[Average Handle Time] ) )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, you could first create this measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Average Time =
AVERAGE( 'f_Call Metrics'[Average Handle Time] )&lt;/LI-CODE&gt;
&lt;P&gt;then use it within &lt;STRONG&gt;Max Time per Agent&lt;/STRONG&gt;:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Max Time per Agent =
MAXX (
    VALUES ( 'f_call Metrics'[Agent] ),
    [Average Time]
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does this work for you?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 03:03:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-a-MAX-value-of-a-summarized-table-in-DAX/m-p/4366156#M173366</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2025-01-16T03:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: Finding a MAX value of a summarized table in DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-a-MAX-value-of-a-summarized-table-in-DAX/m-p/4367307#M173391</link>
      <description>&lt;P&gt;That worked, thank you! Although I wonder why I can't reference the summarized table and find the MAX that way? Is there some limitation referencing a table that was created within the same measure?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 12:45:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-a-MAX-value-of-a-summarized-table-in-DAX/m-p/4367307#M173391</guid>
      <dc:creator>hobosapien</dc:creator>
      <dc:date>2025-01-16T12:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: Finding a MAX value of a summarized table in DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-a-MAX-value-of-a-summarized-table-in-DAX/m-p/4367444#M173396</link>
      <description>&lt;P&gt;I'm glad it worked &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You certainly can reference a summarized table if you like. I tend to avoid this approach where possible because the summarized table is materialized in memory when the measure is evaluated, which will have an impact on performance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Firstly, a couple of things to note:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;In general you should not add extended columns with the &lt;STRONG&gt;SUMMARIZE&lt;/STRONG&gt; function itself. Instead, use &lt;STRONG&gt;ADDCOLUMNS&lt;/STRONG&gt; ( &lt;STRONG&gt;SUMMARIZE&lt;/STRONG&gt; ( ... ) ). See &lt;A href="https://www.sqlbi.com/articles/best-practices-using-summarize-and-addcolumns/" target="_blank" rel="noopener"&gt;this article&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;When using &lt;STRONG&gt;ADDCOLUMNS/SUMMARIZE&lt;/STRONG&gt;, the extended column expressions must be wrapped in CALCULATE (context transition).&lt;/LI&gt;
&lt;LI&gt;If there is a single grouping column specified within &lt;STRONG&gt;SUMMARIZE&lt;/STRONG&gt; and it is from the same table as the first argument, you can just use &lt;STRONG&gt;VALUES&lt;/STRONG&gt;&amp;nbsp;with a single column argument (if there are no extended columns).&lt;BR /&gt;In other words, &lt;STRONG&gt;SUMMARIZE ( tbl, tbl[col] )&lt;/STRONG&gt; and &lt;STRONG&gt;VALUES ( tbl[col] )&lt;/STRONG&gt; are equivalent.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Taking the above into account, you could write your measure as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Max Time per Agent =
VAR AgentTime =
    ADDCOLUMNS (
        VALUES ( 'f_call Metrics'[Agent] ), -- or SUMMARIZE ( 'f_call Metrics', 'f_call Metrics'[Agent] )
        "AVG Talk Time",
        CALCULATE ( AVERAGE ( 'f_Call Metrics'[Average Handle Time] ) )
    )
VAR MaxAgentTime =
    MAXX ( AgentTime, [AVG Talk Time] )
RETURN
    MaxAgentTime&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you did want to use &lt;STRONG&gt;SUMMARIZE&lt;/STRONG&gt; itself to add columns (though I would not recommend this), it would look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Max Time per Agent =
VAR AgentTime =
    SUMMARIZE (
        'f_call Metrics',
        'f_call Metrics'[Agent],
        "AVG Talk Time",
        AVERAGE ( 'f_Call Metrics'[Average Handle Time] ) -- CALCULATE not required
    )
VAR MaxAgentTime =
    MAXX ( AgentTime, [AVG Talk Time] )
RETURN
    MaxAgentTime&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In both cases, you don't have to create the &lt;STRONG&gt;AgentTime&lt;/STRONG&gt; variable. You could just move the &lt;STRONG&gt;AgentTime&lt;/STRONG&gt; expression inside &lt;STRONG&gt;MAXX&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 14:04:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-a-MAX-value-of-a-summarized-table-in-DAX/m-p/4367444#M173396</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2025-01-16T14:04:54Z</dc:date>
    </item>
  </channel>
</rss>

