<?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: Max of four values in a measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-of-four-values-in-a-measure/m-p/3331678#M124867</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="329103" data-lia-user-login="JrBIAnalyst" class="lia-mention lia-mention-user"&gt;JrBIAnalyst&lt;/a&gt;&amp;nbsp;Hi!&lt;BR /&gt;&lt;SPAN&gt;In my opinion, instead of nesting multiple MAX functions, you can use the MAXX function in combination with VALUES to iterate over the four variables and find the maximum value:&lt;BR /&gt;RETURN MAXX(VALUES("TempTable"[TempColumn]), [Variable])&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BBF&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Jul 2023 18:00:58 GMT</pubDate>
    <dc:creator>BeaBF</dc:creator>
    <dc:date>2023-07-14T18:00:58Z</dc:date>
    <item>
      <title>Max of four values in a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-of-four-values-in-a-measure/m-p/3331524#M124853</link>
      <description>&lt;P&gt;This falls under the heading of "It works, but surely there's a better way to do this."&lt;BR /&gt;&lt;BR /&gt;Background: I have a measure using LINEST to project results based on current data. I want to calculate and display the upper and lower bound of the LINEST as error bars. You can interpret the results of LINEST as y = (Slope1 +/- StandardErrorSlope1) * x + (Intercept +/- StandardErrorIntercept) which provides a range of values bounding the result of the LINEST expression. That means there are four possible expressions (++, +-, -+, and --) that could return the bounding values of y.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In DAX terms, that looks like this.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;CPI-U Linest UB = 
VAR line =
    LINESTX (
        CalculateTable(CPI, AND(CPI[Month] &amp;gt;= SELECTEDVALUE('Reference Month'[Month]), CPI[DateType] = "current")),
        CPI[CPI-U],
        CPI[Month]
    )
VAR m = SELECTCOLUMNS ( line, [Slope1] )
VAR em = SELECTCOLUMNS ( line, [StandardErrorSlope1] )
VAR b = SELECTCOLUMNS ( line, [Intercept] )
VAR eb = SELECTCOLUMNS ( line, [StandardErrorIntercept] )
VAR x = SELECTEDVALUE ( CPI[Month] )
VAR ypp = (m + em) * x + (b + eb)
VAR ypm = (m + em) * x + (b - eb)
VAR ymp = (m - em) * x + (b + eb)
VAR ymm = (m - em) * x + (b - eb)
RETURN Max(Max(Max(ypp,ypm),ymp),ymm)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;My question relates to that last line,&amp;nbsp;&lt;SPAN&gt;RETURN&lt;/SPAN&gt; &lt;SPAN&gt;Max&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Max&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Max&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ypp&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;ypm&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;ymp&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;ymm&lt;/SPAN&gt;&lt;SPAN&gt;). Surely, there's a better way to return the Max of four variables... right?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2023 15:42:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-of-four-values-in-a-measure/m-p/3331524#M124853</guid>
      <dc:creator>JrBIAnalyst</dc:creator>
      <dc:date>2023-07-14T15:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Max of four values in a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-of-four-values-in-a-measure/m-p/3331678#M124867</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="329103" data-lia-user-login="JrBIAnalyst" class="lia-mention lia-mention-user"&gt;JrBIAnalyst&lt;/a&gt;&amp;nbsp;Hi!&lt;BR /&gt;&lt;SPAN&gt;In my opinion, instead of nesting multiple MAX functions, you can use the MAXX function in combination with VALUES to iterate over the four variables and find the maximum value:&lt;BR /&gt;RETURN MAXX(VALUES("TempTable"[TempColumn]), [Variable])&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BBF&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2023 18:00:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-of-four-values-in-a-measure/m-p/3331678#M124867</guid>
      <dc:creator>BeaBF</dc:creator>
      <dc:date>2023-07-14T18:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Max of four values in a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-of-four-values-in-a-measure/m-p/3339008#M125291</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="202311" data-lia-user-login="BeaBF" class="lia-mention lia-mention-user"&gt;BeaBF&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had looked at something like that and concluded that constructing the tempTable felt more complicated than nesting maxes. How would you go about creating that tempTable?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 15:56:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-of-four-values-in-a-measure/m-p/3339008#M125291</guid>
      <dc:creator>JrBIAnalyst</dc:creator>
      <dc:date>2023-07-19T15:56:19Z</dc:date>
    </item>
  </channel>
</rss>

