<?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: Subtotal miscaculation using an IF function in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2257118#M54501</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="332147" data-lia-user-login="v-zhangti" class="lia-mention lia-mention-user"&gt;v-zhangti&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Dec 2021 16:11:06 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-12-27T16:11:06Z</dc:date>
    <item>
      <title>Subtotal miscaculation using an IF function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2253584#M54355</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been strugglin to solve the situation with the formula below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DM EX 50% =&lt;/P&gt;&lt;P&gt;IF([GAP HORAS]&amp;lt;0,0,&lt;/P&gt;&lt;P&gt;((SUM('PLANNED HOURS'[MAINTENANCE BUDGET]) - SUM('WORK_ORDER_CODING_UIV'[MAINTENANCE COST]) - SUM('PLANNED HOURS'[MAINTENANCE BUDGET DM]))*0.5))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;The thing is that at row level the calculations are okay, but when I see the subtotal, it is still considering the "GAP HORAS" value at that level (subtotal) and redoing the calculus, instead of adding every row value above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas about how to solve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 11:17:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2253584#M54355</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-23T11:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: Subtotal miscaculation using an IF function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2253613#M54356</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="315278" data-lia-user-login="VahidDM" class="lia-mention lia-mention-user"&gt;VahidDM&lt;/a&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="39298" data-lia-user-login="AlexisOlson" class="lia-mention lia-mention-user"&gt;AlexisOlson&lt;/a&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="24978" data-lia-user-login="smpa01" class="lia-mention lia-mention-user"&gt;smpa01&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 11:28:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2253613#M54356</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-23T11:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Subtotal miscaculation using an IF function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2253725#M54357</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt; , You need force row context using all matrix rows . This is an example using correct fact and dimension in summarize you need to do that &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;sumx(ADDCOLUMNS( summarize( 'WORK_ORDER_CODING_UIV', 'WORK_ORDER_CODING_UIV'[Contract], 'WORK_ORDER_CODING_UIV'[Year]), "_1",&lt;BR /&gt;calculate(IF([GAP HORAS]&amp;lt;0,0,&lt;BR /&gt;((SUM('PLANNED HOURS'[MAINTENANCE BUDGET]) - SUM('WORK_ORDER_CODING_UIV'[MAINTENANCE COST]) - SUM('PLANNED HOURS'[MAINTENANCE BUDGET DM]))*0.5)))), [_1])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;why my grand total is wrong -https://&lt;A href="http://www.youtube.com/watch?v=ufHOOLdi_jk" target="_blank"&gt;www.youtube.com/watch?v=ufHOOLdi_jk&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 12:39:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2253725#M54357</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-12-23T12:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: Subtotal miscaculation using an IF function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2253783#M54362</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;, thanks for your time and reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I found out this as a possible solution, the thing is that I couldn't been able to use it effectively.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MEASURE = &lt;/SPAN&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ADDCOLUMNS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUMMARIZE&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;WORK_ORDER_CODING_UIV&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'CONTRACT'[CONTRACT]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'CALENDAR'[PERIOD]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;FLEET[MODEL]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;WORK_ORDER_CODING_UIV[QD. TAG]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;FLEET[TAG]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'CALENDAR'[DATE]&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;"_1"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[GAP HORAS]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;((&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'PLANNED HOURS'[MAINTENANCE BUDGET]&lt;/SPAN&gt;&lt;SPAN&gt;) - &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'WORK_ORDER_CODING_UIV'[MAINTENANCE COST]&lt;/SPAN&gt;&lt;SPAN&gt;) - &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'PLANNED HOURS'[MAINTENANCE BUDGET DM]&lt;/SPAN&gt;&lt;SPAN&gt;))*&lt;/SPAN&gt;&lt;SPAN&gt;0.5&lt;/SPAN&gt;&lt;SPAN&gt;)))), &lt;/SPAN&gt;&lt;SPAN&gt;[_1]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt; &lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;OL&gt;&lt;LI&gt;Youtube solution:&lt;/LI&gt;&lt;/OL&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I tried to contextualize and see how it fits, but the result was the same as in the post (result per row okay, per total not).&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;T. DM EX 50% = &lt;/SPAN&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;HASONEVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'PLANNED HOURS'[QD. TAG]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;[DM EX 50%]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'PLANNED HOURS'[QD. TAG]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;[DM EX 50%]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt; &lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 23 Dec 2021 13:33:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2253783#M54362</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-23T13:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: Subtotal miscaculation using an IF function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2253791#M54365</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt; , Try like&lt;/P&gt;
&lt;P&gt;IF(HASONEVALUE('PLANNED HOURS'[QD. TAG]),&lt;BR /&gt;IF([GAP HORAS]&amp;lt;0,0,&lt;/P&gt;
&lt;P&gt;((SUM('PLANNED HOURS'[MAINTENANCE BUDGET]) - SUM('WORK_ORDER_CODING_UIV'[MAINTENANCE COST]) - SUM('PLANNED HOURS'[MAINTENANCE BUDGET DM]))*0.5))&lt;BR /&gt;,&lt;BR /&gt;((SUM('PLANNED HOURS'[MAINTENANCE BUDGET]) - SUM('WORK_ORDER_CODING_UIV'[MAINTENANCE COST]) - SUM('PLANNED HOURS'[MAINTENANCE BUDGET DM]))*0.5)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or you have use summarize to get more than one column to group&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 13:42:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2253791#M54365</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-12-23T13:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Subtotal miscaculation using an IF function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2253798#M54367</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;In that case is doing the calculation at subtotal level:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 14:44:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2253798#M54367</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-23T14:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: Subtotal miscaculation using an IF function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2253875#M54375</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 14:44:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2253875#M54375</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-23T14:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: Subtotal miscaculation using an IF function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2256375#M54464</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the above response does not solve your problem.&amp;nbsp;Can you provide easy to use PBIX files for testing?&amp;nbsp;What kind of results do you expect? You can mark it in the screenshot.&amp;nbsp;Looking forward to your reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Charlotte&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 06:15:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2256375#M54464</guid>
      <dc:creator>v-zhangti</dc:creator>
      <dc:date>2021-12-27T06:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: Subtotal miscaculation using an IF function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2256833#M54483</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the link to download the PBI Sample, as requested (couldn't find a way to attach it here):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://mega.nz/file/EZoFma5L#IzVrFTbbQjb0mKfktiu3Nc4GYOEIJ1Z6Avvja9sQkRM" target="_blank"&gt;https://mega.nz/file/EZoFma5L#IzVrFTbbQjb0mKfktiu3Nc4GYOEIJ1Z6Avvja9sQkRM&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a column called "GAP HORAS" and I created a measure that uses this column with the following expression:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Measure = &lt;/SPAN&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;data[GAP HORAS]&lt;/SPAN&gt;&lt;SPAN&gt;)&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;What happens is that per row level, the formula is okay, but at subtotal level it is not. For example the correct answer for half of the matrix would be 8 instead of 0 (the sum of each individual row instead of recalculate the value at subtotal/total level.)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 11:33:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2256833#M54483</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-27T11:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: Subtotal miscaculation using an IF function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2257118#M54501</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="332147" data-lia-user-login="v-zhangti" class="lia-mention lia-mention-user"&gt;v-zhangti&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 16:11:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2257118#M54501</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-27T16:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: Subtotal miscaculation using an IF function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2257641#M54526</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I replaced the Measure you used for "GAP HORAS" with a calculated column.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Column = IF([GAP HORAS]&amp;lt;0,0,1)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure 2 = 
IF (
    HASONEVALUE ( 'data'[Column] ),
    MAX ( 'data'[Column]),
    SUM ( 'data'[Column] )
)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Is this the result you expect?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Charlotte&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Dec 2021 03:12:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2257641#M54526</guid>
      <dc:creator>v-zhangti</dc:creator>
      <dc:date>2021-12-28T03:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: Subtotal miscaculation using an IF function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2258420#M54560</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="332147" data-lia-user-login="v-zhangti" class="lia-mention lia-mention-user"&gt;v-zhangti&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your understanding is correct but unfortunately I couldn't replicate. I believe the reason is because the sample that I shared with you contains values and the actual .pbix file that I am using contains measures.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the example given in the sample before I tried to contextualize what I actually need: fix the "DM EX 50%" column, this column uses an IF condition (IF GAP Horas &amp;lt; 0, TRUE = 0, FALSE = Does a calculation) so the correct amount at total level in the print below is $ 1233,34 (sum of every row value):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DM EX 50% = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[GAP HORAS]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;((&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'PLANNED HOURS'[MAINTENANCE BUDGET]&lt;/SPAN&gt;&lt;SPAN&gt;) - &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'WORK_ORDER_CODING_UIV'[MAINTENANCE COST]&lt;/SPAN&gt;&lt;SPAN&gt;) - &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'PLANNED HOURS'[MAINTENANCE BUDGET DM]&lt;/SPAN&gt;&lt;SPAN&gt;))*&lt;/SPAN&gt;&lt;SPAN&gt;0.5&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The link for the file of the print above is here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://mega.nz/file/kVwUWJ4b#RL4H-a9bOeWL0bf0WRZaGyw5lJc9yimYfueUPlfc-tY" target="_blank"&gt;https://mega.nz/file/kVwUWJ4b#RL4H-a9bOeWL0bf0WRZaGyw5lJc9yimYfueUPlfc-tY&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Dec 2021 13:54:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2258420#M54560</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-28T13:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: Subtotal miscaculation using an IF function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2259026#M54579</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp; I am not sure&amp;nbsp;if I understand it correctly. It looks like this is a common subtotals issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the following is the result you want to return, then use my code. Thanks.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure = 
SUMX (
    SUMMARIZE ( data, 'data'[PERIOD], 'data'[TAG], 'data'[QD. TAG], 'data'[DATE] ),
    CALCULATE ( IF ( SUM ( data[GAP HORAS] ) &amp;lt; 0, 0, 1 ) )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 29 Dec 2021 04:54:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2259026#M54579</guid>
      <dc:creator>jameszhang0805</dc:creator>
      <dc:date>2021-12-29T04:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: Subtotal miscaculation using an IF function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2259957#M54611</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="285661" data-lia-user-login="jameszhang0805" class="lia-mention lia-mention-user"&gt;jameszhang0805&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sorry but I still couldn't do what I need:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The column [GAP HORAS] is a "bonus prize", so I have a formula that has an IF Conditional. The thing is that I need to sum the values at subtotal level [GAP HORAS] &amp;gt; 0 (goal achieved)&lt;/P&gt;&lt;P&gt;If [GAP HORAS] at subtotal level is &amp;lt; 0, result is 0 or blank.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The thing is that the IF function is also working at TOTAL level, so regardless the value of each SUBTOTAL, if the GAP HORAS is &amp;lt; 0 at TOTAL level, the result is 0 (not what I expect). See examples:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For a subtotal with GAP HORAS &amp;lt; 0. Expected result = 0 (regardless the values of each row above).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The formula that I am using is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DM EX 50% = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[GAP HORAS]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;BLANK&lt;/SPAN&gt;&lt;SPAN&gt;(),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;((&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'PLANNED HOURS'[MAINTENANCE BUDGET]&lt;/SPAN&gt;&lt;SPAN&gt;) - &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'WORK_ORDER_CODING_UIV'[MAINTENANCE COST]&lt;/SPAN&gt;&lt;SPAN&gt;) - &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'PLANNED HOURS'[MAINTENANCE BUDGET DM]&lt;/SPAN&gt;&lt;SPAN&gt;))*&lt;/SPAN&gt;&lt;SPAN&gt;0.5&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Reminding that [GAP HORAS] is also a measure.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 29 Dec 2021 17:09:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtotal-miscaculation-using-an-IF-function/m-p/2259957#M54611</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-29T17:09:13Z</dc:date>
    </item>
  </channel>
</rss>

