<?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 A function 'MAX' has been used in a True/False expression that is used as a table filter expression. in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/A-function-MAX-has-been-used-in-a-True-False-expression-that-is/m-p/3964605#M153789</link>
    <description>&lt;P&gt;I am trying to create a card that shows the reduction in emissions for a school. I created a measure for total beef purchases:&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Total Emissions:= SUM(tSustainability_FactBeefEmissions[CO2 (tonnes)])&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;Then I created a percentage measure:&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Emission difference (pecentage):= &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Var EarliestData = CALCULATE([Total Emissions], tSustainability_FactBeefEmissions[Order] = MIN(tSustainability_FactBeefEmissions[Order])) &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;VAR LatestData = CALCULATE([Total Emissions], tSustainability_FactBeefEmissions[Order] =Max(tSustainability_FactBeefEmissions[Order]))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;RETURN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;FORMAT( (LatestData - EarliestData)/EarliestData, "0%")&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The measure returns the right value in visual studio. When I deploy the solution in pbi desktop I get the message that a MIN has been used in a true/false expression. How do I make dax pick the value in the emission column that is corresponding to the lowest value in the order column?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 31 May 2024 14:25:36 GMT</pubDate>
    <dc:creator>datagoblin77</dc:creator>
    <dc:date>2024-05-31T14:25:36Z</dc:date>
    <item>
      <title>A function 'MAX' has been used in a True/False expression that is used as a table filter expression.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/A-function-MAX-has-been-used-in-a-True-False-expression-that-is/m-p/3964605#M153789</link>
      <description>&lt;P&gt;I am trying to create a card that shows the reduction in emissions for a school. I created a measure for total beef purchases:&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Total Emissions:= SUM(tSustainability_FactBeefEmissions[CO2 (tonnes)])&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;Then I created a percentage measure:&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Emission difference (pecentage):= &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Var EarliestData = CALCULATE([Total Emissions], tSustainability_FactBeefEmissions[Order] = MIN(tSustainability_FactBeefEmissions[Order])) &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;VAR LatestData = CALCULATE([Total Emissions], tSustainability_FactBeefEmissions[Order] =Max(tSustainability_FactBeefEmissions[Order]))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;RETURN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;FORMAT( (LatestData - EarliestData)/EarliestData, "0%")&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The measure returns the right value in visual studio. When I deploy the solution in pbi desktop I get the message that a MIN has been used in a true/false expression. How do I make dax pick the value in the emission column that is corresponding to the lowest value in the order column?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 14:25:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/A-function-MAX-has-been-used-in-a-True-False-expression-that-is/m-p/3964605#M153789</guid>
      <dc:creator>datagoblin77</dc:creator>
      <dc:date>2024-05-31T14:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: A function 'MAX' has been used in a True/False expression that is used as a table filter expression.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/A-function-MAX-has-been-used-in-a-True-False-expression-that-is/m-p/3964616#M153790</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="728922" data-lia-user-login="datagoblin77" class="lia-mention lia-mention-user"&gt;datagoblin77&lt;/a&gt;&amp;nbsp;try with:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Emission difference (percentage):=&lt;BR /&gt;VAR EarliestOrder = CALCULATE(MIN(tSustainability_FactBeefEmissions[Order]))&lt;BR /&gt;VAR EarliestEmission = CALCULATE([Total Emissions], tSustainability_FactBeefEmissions[Order] = EarliestOrder)&lt;/P&gt;&lt;P&gt;VAR LatestOrder = CALCULATE(MAX(tSustainability_FactBeefEmissions[Order]))&lt;BR /&gt;VAR LatestEmission = CALCULATE([Total Emissions], tSustainability_FactBeefEmissions[Order] = LatestOrder)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;FORMAT( (LatestEmission - EarliestEmission)/EarliestEmission, "0%")&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 14:30:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/A-function-MAX-has-been-used-in-a-True-False-expression-that-is/m-p/3964616#M153790</guid>
      <dc:creator>BeaBF</dc:creator>
      <dc:date>2024-05-31T14:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: A function 'MAX' has been used in a True/False expression that is used as a table filter expression.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/A-function-MAX-has-been-used-in-a-True-False-expression-that-is/m-p/3964645#M153791</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="728922" data-lia-user-login="datagoblin77" class="lia-mention lia-mention-user"&gt;datagoblin77&lt;/a&gt;&amp;nbsp;- By putting the MIN and MAX next to an = you turn it into a TRUE/FALSE expression.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should try this:&lt;/P&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;VAR _min =
    MIN ( tSustainability_FactBeefEmissions[Order] )
VAR _max =
    MAX ( tSustainability_FactBeefEmissions[Order] )
VAR min_Emission =
    CALCULATE (
        [Total Emissions],
        KEEPFILTERS ( tSustainability_FactBeefEmissions[Order] = _min )
    )
VAR max_Emission =
    CALCULATE (
        [Total Emissions],
        KEEPFILTERS ( tSustainability_FactBeefEmissions[Order] = _max )
    )
RETURN
    DIVIDE ( ( max_Emission - min_Emission ), min_Emission, 0 )&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;P&gt;KEEPFILTERS is used to maintain this filter context, but not overwrite any others, which if you use this calculation elsewhere will prevent a confusing output.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DIVIDE is more optimal than using "/" and it helps with divide by 0 errors which "/" will not.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also removed your FORMAT expression, because this is turning the figure presented into a string. By using the Power BI UI to make this a % you will have much more freedom, and can use this calculation for conditional formatting etc. You can do this by selecting the measure and selecting &lt;STRONG&gt;Percentage&lt;/STRONG&gt; from the &lt;STRONG&gt;Format&lt;/STRONG&gt; options on &lt;STRONG&gt;Measure Tools:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;If this works for you, please mark it as the solution!&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 14:51:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/A-function-MAX-has-been-used-in-a-True-False-expression-that-is/m-p/3964645#M153791</guid>
      <dc:creator>mark_endicott</dc:creator>
      <dc:date>2024-05-31T14:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: A function 'MAX' has been used in a True/False expression that is used as a table filter expression.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/A-function-MAX-has-been-used-in-a-True-False-expression-that-is/m-p/3964784#M153793</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 16:03:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/A-function-MAX-has-been-used-in-a-True-False-expression-that-is/m-p/3964784#M153793</guid>
      <dc:creator>datagoblin77</dc:creator>
      <dc:date>2024-05-31T16:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: A function 'MAX' has been used in a True/False expression that is used as a table filter expression.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/A-function-MAX-has-been-used-in-a-True-False-expression-that-is/m-p/3964803#M153794</link>
      <description>&lt;P&gt;Happy to help!&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 16:24:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/A-function-MAX-has-been-used-in-a-True-False-expression-that-is/m-p/3964803#M153794</guid>
      <dc:creator>mark_endicott</dc:creator>
      <dc:date>2024-05-31T16:24:12Z</dc:date>
    </item>
  </channel>
</rss>

