<?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: Measure Total incorrect in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Total-incorrect/m-p/810314#M5190</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;Anonymous&lt;/LI-USER&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you don't get 0 in the column total of [additional to planned] because [actual] is greater than [planned], but because in your if-statement use hasonefilter([UserID]). In the total you don't have a filter on UserID, as you want to see the sum for all users which satisfy the conditions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this instead&lt;/P&gt;&lt;PRE&gt;Actual - Planned =
VAR _tmp =
    SUMX (
        FILTER ( 'Table'; 'Table'[Actual] &amp;gt; [Planned] );
        'Table'[Actual] - 'Table'[Planned]
    )
RETURN
    IF ( ISBLANK ( _tmp ); 0; _tmp )&lt;/PRE&gt;&lt;P&gt;The code between VAR and RETURN is not neccessary, it is just there to make to code cleaner and easier to read, as you only need to write the SUMX-part once.&lt;/P&gt;</description>
    <pubDate>Fri, 04 Oct 2019 22:31:09 GMT</pubDate>
    <dc:creator>sturlaws</dc:creator>
    <dc:date>2019-10-04T22:31:09Z</dc:date>
    <item>
      <title>Measure Total incorrect</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Total-incorrect/m-p/810074#M5174</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am struggling with a measure total.&amp;nbsp; My row total is fine but the grand total at the bottom is wrong (just the one cell!) I can see why it is wrong but I'm not sure how to fix it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you look at the image you will see that I have planned and an actual colum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;planned is measure summing:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;= CALCULATE (&lt;BR /&gt;SUM('Activity_view (2)'[Hours]),&lt;BR /&gt;FILTER (&lt;BR /&gt;'Activity_view (2)',&lt;BR /&gt;'Activity_view (2)'[SQL_ID] = 2&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;unplanned is a measure summing this:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;= CALCULATE (&lt;BR /&gt;SUM('Activity_view (2)'[Adherance Hours]),&lt;BR /&gt;FILTER (&lt;BR /&gt;'Activity_view (2)',&lt;BR /&gt;'Activity_view (2)'[SQL_ID] = 1 &amp;amp;&amp;amp; 'Activity_view (2)'[transtype] = 2&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;and additonal to planned this:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;= IF ([Over Hours Actual Planned] - [Over Hours Planned] &amp;lt;0 , 0 , SUMX('Activity_view (2)',[Over Hours Actual Planned] - [Over Hours Planned]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried this and it actually returns nothing:-&lt;/P&gt;&lt;P&gt;= IF(HASONEFILTER('Activity_view (2)'[UserID]),&lt;BR /&gt;IF ([Over Hours Actual Planned] - [Over Hours Planned] &amp;lt;0 , 0 , SUMX('Activity_view (2)',[Over Hours Actual Planned] - [Over Hours Planned])))&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 15:29:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Total-incorrect/m-p/810074#M5174</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-04T15:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Measure Total incorrect</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Total-incorrect/m-p/810314#M5190</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;Anonymous&lt;/LI-USER&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you don't get 0 in the column total of [additional to planned] because [actual] is greater than [planned], but because in your if-statement use hasonefilter([UserID]). In the total you don't have a filter on UserID, as you want to see the sum for all users which satisfy the conditions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this instead&lt;/P&gt;&lt;PRE&gt;Actual - Planned =
VAR _tmp =
    SUMX (
        FILTER ( 'Table'; 'Table'[Actual] &amp;gt; [Planned] );
        'Table'[Actual] - 'Table'[Planned]
    )
RETURN
    IF ( ISBLANK ( _tmp ); 0; _tmp )&lt;/PRE&gt;&lt;P&gt;The code between VAR and RETURN is not neccessary, it is just there to make to code cleaner and easier to read, as you only need to write the SUMX-part once.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 22:31:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Total-incorrect/m-p/810314#M5190</guid>
      <dc:creator>sturlaws</dc:creator>
      <dc:date>2019-10-04T22:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Measure Total incorrect</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Total-incorrect/m-p/811169#M5219</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am struggling somewhat with this, i have tried your suggestion&amp;nbsp;but my values are measures they aggregated&amp;nbsp; rows together first.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried your with the measures and with the full syntax as if the measure didn’t exist but i can’t get it working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the measure for actual and planned is below...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Over Hours&amp;nbsp;Actually Worked&amp;nbsp;= CALCULATE (&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SUM('Activity_view (2)'[Adherence Hours]),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FILTER (&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Activity_view (2)',&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Activity_view (2)'[SQL_ID] = 1 &amp;amp;&amp;amp; 'Activity_view (2)'[transtype] = 2&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Over Hours Planned = CALCULATE (&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SUM('Activity_view (2)'[Hours]),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FILTER (&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Activity_view (2)',&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Activity_view (2)'[SQL_ID] = 2&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need a way of taking one from the other (if actual is greater than 0 then show a value else 0) and this works using the below measure it’s just all the totals are 0?&amp;nbsp; it’s got me stuck!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is another way I have tried, and it again works for the row but not the total...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Over Hours Unplanned = IF ([Over Hours Actually worked] - [Over Hours Planned] &amp;lt;0 , 0 , [Over Hours Actually worked] - [Over Hours Planned])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2019 09:32:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Total-incorrect/m-p/811169#M5219</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-07T09:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Measure Total incorrect</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Total-incorrect/m-p/811391#M5233</link>
      <description>&lt;P&gt;ok, this has been causing me a problem all day but ive cracked it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a second measure that uses the first:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Over_Hours_Unplanned_Step_1 = IF(SUMX('Activity_view (2)',[Over Hours Actual Planned] - [Over Hours Planned]) &amp;lt; 0, 0, [Over Hours Actual Planned] - [Over Hours Planned])&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Over_Hours_Unplanned_Step_2 = VAR __Unplanned = Summarize('Activity_view (2)','Activity_view (2)'[UserID],"__value",[Over Hours Unplanned_S1])&lt;BR /&gt;RETURN&lt;BR /&gt;IF(HASONEVALUE('Activity_view (2)'[UserID]),[Over Hours Unplanned_S1],SUMX(__Unplanned,[__value]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and all is well!&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2019 13:40:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Total-incorrect/m-p/811391#M5233</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-07T13:40:20Z</dc:date>
    </item>
  </channel>
</rss>

