<?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 Total not equal to rows gotten by if statement DAX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-not-equal-to-rows-gotten-by-if-statement-DAX/m-p/966429#M11452</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello to everybody,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem:&lt;/P&gt;&lt;P&gt;Grand Total not equal to rows gotten by if statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dax for Column "Sutarčių vertė":&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;Sutarčių vertė = &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;Var KPIbyCondition = if(or([Projekto vertė PTD]=0;ISBLANK([Projekto vertė PTD]));[Pagrindinės veiklos pajamos];[Projekto vertė])&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;Return&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;CALCULATE(KPIbyCondition;ALLSELECTED(Sutartys[Sutarties Nr.2]))&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;Thank you for your help&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="ics-element-donot-delete 1001_CC@"&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Mar 2020 09:22:28 GMT</pubDate>
    <dc:creator>Justas</dc:creator>
    <dc:date>2020-03-10T09:22:28Z</dc:date>
    <item>
      <title>Total not equal to rows gotten by if statement DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-not-equal-to-rows-gotten-by-if-statement-DAX/m-p/966429#M11452</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello to everybody,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem:&lt;/P&gt;&lt;P&gt;Grand Total not equal to rows gotten by if statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dax for Column "Sutarčių vertė":&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;Sutarčių vertė = &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;Var KPIbyCondition = if(or([Projekto vertė PTD]=0;ISBLANK([Projekto vertė PTD]));[Pagrindinės veiklos pajamos];[Projekto vertė])&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;Return&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;CALCULATE(KPIbyCondition;ALLSELECTED(Sutartys[Sutarties Nr.2]))&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;Thank you for your help&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="ics-element-donot-delete 1001_CC@"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 09:22:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-not-equal-to-rows-gotten-by-if-statement-DAX/m-p/966429#M11452</guid>
      <dc:creator>Justas</dc:creator>
      <dc:date>2020-03-10T09:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Total not equal to rows gotten by if statement DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-not-equal-to-rows-gotten-by-if-statement-DAX/m-p/966598#M11458</link>
      <description>Variables are STATIC. Using them in CALCULATE does not change their value.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
      <pubDate>Tue, 10 Mar 2020 10:47:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-not-equal-to-rows-gotten-by-if-statement-DAX/m-p/966598#M11458</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-03-10T10:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: Total not equal to rows gotten by if statement DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-not-equal-to-rows-gotten-by-if-statement-DAX/m-p/968364#M11520</link>
      <description>&lt;P&gt;&lt;FONT color="#000000"&gt;This is a very common issue that you face in DAX.&amp;nbsp;The grand total in DAX doesn't work like excel where it would go and add the values in the column.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Each cell is calculated independently by DAX, including the grand total value.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;The result from the dax formula you wrote is correct. To understand, you need to look at the calcuation in the grand total line.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;As per the fomula, if [&lt;SPAN&gt;Projekto vertė PTD] is null or blank, give [Pagrindinės veiklos pajamos] else&amp;nbsp; [Projekto vertė PTD].&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Now the value for&amp;nbsp;[&lt;SPAN&gt;Projekto vertė PTD] for the grand total line is 561,537.00. It is not blank or null, therefore, the result of this dax formula will be 561,537. and not 430.568 as you expect&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;To overcome this issue, you need to use SUMX to make sure that the grand total adds up to the individual cells.&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;An example of that would be&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sumx([Table], if(or([Projekto vertė PTD]=0;ISBLANK([Projekto vertė PTD]));[Pagrindinės veiklos pajamos];[Projekto vertė])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;Hope this helps&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 11 Mar 2020 07:54:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-not-equal-to-rows-gotten-by-if-statement-DAX/m-p/968364#M11520</guid>
      <dc:creator>Nishantjain</dc:creator>
      <dc:date>2020-03-11T07:54:11Z</dc:date>
    </item>
  </channel>
</rss>

