<?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: Wrong total with IF MAX measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-total-with-IF-MAX-measure/m-p/3156231#M113218</link>
    <description>&lt;P&gt;&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;&amp;nbsp;: Thanks a lot for your support, but still the same issue. No SUM / Total on the right. Still a 0.&lt;/P&gt;
&lt;P&gt;Bot tables are linked 1:n to the calendar table.&lt;/P&gt;</description>
    <pubDate>Mon, 27 Mar 2023 13:49:52 GMT</pubDate>
    <dc:creator>joshua1990</dc:creator>
    <dc:date>2023-03-27T13:49:52Z</dc:date>
    <item>
      <title>Wrong total with IF MAX measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-total-with-IF-MAX-measure/m-p/3155914#M113197</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;
&lt;P&gt;I have a datamodel with 4 tables:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;2 dimensional tables
&lt;UL&gt;
&lt;LI&gt;Calendar (Date, Year, Month)&lt;/LI&gt;
&lt;LI&gt;Master Data (Article)&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;2 transactional tables
&lt;UL&gt;
&lt;LI&gt;Past Orders (Article, Date, Value)&lt;/LI&gt;
&lt;LI&gt;Open Orders (Article, Date, Value)&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Both transactional tables are related to both dimensional tables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Now I have build a simple matrix and a measure with the following logic:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Orders =
VAR _Orders = [Order Value]
RETURN
IF(MAX('Open Orders'[Date]) &amp;gt; MAX('Past Orders'[Date]), _Orders , 0)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The matrix has Months as columns. The result of the measure is displayed correctly for each month.&lt;/P&gt;
&lt;P&gt;But the sum / total is 0 on the right.&lt;/P&gt;
&lt;P&gt;What is the issue here?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 11:55:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-total-with-IF-MAX-measure/m-p/3155914#M113197</guid>
      <dc:creator>joshua1990</dc:creator>
      <dc:date>2023-03-27T11:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong total with IF MAX measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-total-with-IF-MAX-measure/m-p/3155938#M113198</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92006" data-lia-user-login="joshua1990" class="lia-mention lia-mention-user"&gt;joshua1990&lt;/a&gt;&amp;nbsp;Hi!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try this formula:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Orders = &lt;BR /&gt;VAR _Orders = [Order Value] &lt;BR /&gt;VAR _MaxOpenDate = MAX('Open Orders'[Date]) &lt;BR /&gt;VAR _MaxPastDate = MAX('Past Orders'[Date]) &lt;BR /&gt;RETURN IF(_MaxOpenDate &amp;gt; _MaxPastDate, _Orders, IF(ISBLANK(_MaxOpenDate) || ISBLANK(_MaxPastDate), BLANK(), 0))&lt;BR /&gt;&lt;BR /&gt;This measure will return the order value for all months, but only include the value in the calculation if the 'Open Orders' table has a later date than the 'Past Orders' table. It also includes a check for blank values in case there are missing dates in either of the tables. This should give you the correct sum/total for the 'Orders' measure.&lt;BR /&gt;&lt;BR /&gt;BBF&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 12:03:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-total-with-IF-MAX-measure/m-p/3155938#M113198</guid>
      <dc:creator>BeaBF</dc:creator>
      <dc:date>2023-03-27T12:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong total with IF MAX measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-total-with-IF-MAX-measure/m-p/3156231#M113218</link>
      <description>&lt;P&gt;&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;&amp;nbsp;: Thanks a lot for your support, but still the same issue. No SUM / Total on the right. Still a 0.&lt;/P&gt;
&lt;P&gt;Bot tables are linked 1:n to the calendar table.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 13:49:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-total-with-IF-MAX-measure/m-p/3156231#M113218</guid>
      <dc:creator>joshua1990</dc:creator>
      <dc:date>2023-03-27T13:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong total with IF MAX measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-total-with-IF-MAX-measure/m-p/3156339#M113227</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92006" data-lia-user-login="joshua1990" class="lia-mention lia-mention-user"&gt;joshua1990&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please try&lt;/P&gt;
&lt;P&gt;Orders =&lt;BR /&gt;SUMX (&lt;BR /&gt;VALUES ( 'Calendar'[YearMonth] ),&lt;BR /&gt;CALCULATE (&lt;BR /&gt;VAR _Orders = [Order Value]&lt;BR /&gt;VAR _MaxOpenDate =&lt;BR /&gt;MAX ( 'Open Orders'[Date] )&lt;BR /&gt;VAR _MaxPastDate =&lt;BR /&gt;MAX ( 'Past Orders'[Date] )&lt;BR /&gt;RETURN&lt;BR /&gt;IF ( _MaxOpenDate &amp;gt; _MaxPastDate, _Orders, 0 )&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 14:26:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-total-with-IF-MAX-measure/m-p/3156339#M113227</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-27T14:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong total with IF MAX measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-total-with-IF-MAX-measure/m-p/3156774#M113242</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;: I really don't know why, but still the same issue....&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 17:38:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-total-with-IF-MAX-measure/m-p/3156774#M113242</guid>
      <dc:creator>joshua1990</dc:creator>
      <dc:date>2023-03-27T17:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong total with IF MAX measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-total-with-IF-MAX-measure/m-p/3157628#M113298</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92006" data-lia-user-login="joshua1990" class="lia-mention lia-mention-user"&gt;joshua1990&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Would you please provide a screenshot to help us visualize the problem.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 05:55:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-total-with-IF-MAX-measure/m-p/3157628#M113298</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-28T05:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong total with IF MAX measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-total-with-IF-MAX-measure/m-p/3157791#M113311</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92006" data-lia-user-login="joshua1990" class="lia-mention lia-mention-user"&gt;joshua1990&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The issue could be related to the context in which the measure is being evaluated. When you add up the values of the measure, the total might be showing as zero due to the filter context applied on the table.&lt;/P&gt;
&lt;P&gt;To fix this issue, you can try using the "ALL" function to remove the filter context from the table and evaluate the measure across all rows.&lt;/P&gt;
&lt;P&gt;Here's an updated measure that should work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Orders = &lt;BR /&gt;VAR _Orders = [Order Value]&lt;BR /&gt;RETURN&lt;BR /&gt;IF(&lt;BR /&gt;MAX('Open Orders'[Date]) &amp;gt; MAX('Past Orders'[Date]), &lt;BR /&gt;_Orders, &lt;BR /&gt;0&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;Total Orders = &lt;BR /&gt;CALCULATE(&lt;BR /&gt;[Orders], &lt;BR /&gt;ALL('Calendar'[Month])&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;BBF&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 07:24:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-total-with-IF-MAX-measure/m-p/3157791#M113311</guid>
      <dc:creator>BeaBF</dc:creator>
      <dc:date>2023-03-28T07:24:28Z</dc:date>
    </item>
  </channel>
</rss>

