<?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: Count if measure returns true - error with total value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271183#M55297</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Isn't "Final Cost Amount" a measure? It seems a measure in your original post.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Community Support Team _ kalyj&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jan 2022 08:55:09 GMT</pubDate>
    <dc:creator>v-yanjiang-msft</dc:creator>
    <dc:date>2022-01-07T08:55:09Z</dc:date>
    <item>
      <title>Count if measure returns true - error with total value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2265906#M54895</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I try to count how many documents have a final cost amount &amp;gt;= 500euro.&lt;BR /&gt;For 10 nov 2020 this should return 7.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I created a measure that returns a correct value per row (see table in screenshot).&lt;/P&gt;&lt;P&gt;But the total value is wrong. It says 279 (which is the count of all rows) instead of 7.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;I tried different measures but nothing is working....&lt;BR /&gt;In the above screenshoted table the VAR Test1 is applied.&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;Anyone knows how I need to modify the measure?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Julie&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 16:45:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2265906#M54895</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-04T16:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: Count if measure returns true - error with total value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2265917#M54898</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp; is it kindly possible to provide a sample pbix?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 16:50:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2265917#M54898</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2022-01-04T16:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: Count if measure returns true - error with total value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2265961#M54908</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I think the problem is with your [Final cost amount] measure. I suppose it return more than 500 to all rows.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Now if you use this as your condition in test1 it will return true to all rows since the sum is greater. It seems you use a column instead of your measure in your table. To create the condition measure you can use something like:&lt;BR /&gt;&lt;BR /&gt;Final cost Amount test = SELECTEDVALUE('Table'[Final_cost_amount])&lt;BR /&gt;&lt;BR /&gt;I hope this helps and if it does consider accepting this as a solution and giving the post a thumbs up!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 17:20:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2265961#M54908</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2022-01-04T17:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Count if measure returns true - error with total value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271010#M55287</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;According to your description, here's my solution.&lt;/P&gt;
&lt;P&gt;You can modify the measure like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Final Cost Amount&amp;gt;500euro = 
VAR _T =
    ADDCOLUMNS (
        'FactControlReportsALL',
        "Requirment", IF ( [Final_Cost_Amount] &amp;gt;= 500, 1, BLANK () )
    )
RETURN
    SUMX ( _T, [Requirment] )
&lt;/LI-CODE&gt;
&lt;P&gt;Get the expected result.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I attach my sample below for reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Community Support Team _ kalyj&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 06:50:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271010#M55287</guid>
      <dc:creator>v-yanjiang-msft</dc:creator>
      <dc:date>2022-01-07T06:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Count if measure returns true - error with total value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271096#M55289</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="334520" data-lia-user-login="v-yanjiang-msft" class="lia-mention lia-mention-user"&gt;v-yanjiang-msft&lt;/a&gt;&amp;nbsp;,&amp;nbsp;This solution does not work unfortunantely.&amp;nbsp;&lt;BR /&gt;For precision: in my data one document number can have several rows with different articles.&amp;nbsp;&lt;BR /&gt;In the below table the column document_number is a distinct count.&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 07:42:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271096#M55289</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-07T07:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: Count if measure returns true - error with total value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271107#M55290</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343431" data-lia-user-login="ValtteriN" class="lia-mention lia-mention-user"&gt;ValtteriN&lt;/a&gt;&amp;nbsp;, indeed the VAR Requirement refers to a measure. Sorry forgot to precise this.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[Final Cost Amount] = SUM(FactControlReportsALL[Final_Cost_Amount])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried to use SELECTEDVALUE.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Created VAR Requirement2 and used this in VAR Test1. But it does not behave as expected.&lt;BR /&gt;&lt;BR /&gt;One document number can have several rows in the data (different articles with the same document number). It seems that this measure returns 1 when the final cost amount is &amp;gt;= 500 for one article/row. It should return 1 if the final cost amount is &amp;gt;= 500 for the document number (so sum of final cost amount of the different rows with same document number).&amp;nbsp;&lt;BR /&gt;Also the total value is blank &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 07:58:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271107#M55290</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-07T07:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Count if measure returns true - error with total value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271117#M55291</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Try to modify the measure like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Final Cost Amount&amp;gt;500euro = 
VAR _T =
    ADDCOLUMNS (
        DISTINCT('FactControlReportsALL'[Document_Number]),
        "Requirment", IF ( [Final_Cost_Amount] &amp;gt;= 500, 1, BLANK () )
    )
RETURN
    SUMX ( _T,[Requirment] )
&lt;/LI-CODE&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Community Support Team _ kalyj&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 08:02:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271117#M55291</guid>
      <dc:creator>v-yanjiang-msft</dc:creator>
      <dc:date>2022-01-07T08:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Count if measure returns true - error with total value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271166#M55295</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="334520" data-lia-user-login="v-yanjiang-msft" class="lia-mention lia-mention-user"&gt;v-yanjiang-msft&lt;/a&gt;&amp;nbsp;, it is still not working.&amp;nbsp;&lt;BR /&gt;The row values are now correct, but the total value is wrong.&amp;nbsp;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 08:45:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271166#M55295</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-07T08:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: Count if measure returns true - error with total value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271183#M55297</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Isn't "Final Cost Amount" a measure? It seems a measure in your original post.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Community Support Team _ kalyj&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 08:55:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271183#M55297</guid>
      <dc:creator>v-yanjiang-msft</dc:creator>
      <dc:date>2022-01-07T08:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: Count if measure returns true - error with total value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271191#M55298</link>
      <description>&lt;P&gt;Yes &lt;SPAN&gt;[Final Cost Amount] was a&lt;/SPAN&gt;&amp;nbsp;measure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;[Final Cost Amount] = SUM(FactControlReportsALL[Final_Cost_Amount])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I wrote it out in the 'final cost amount &amp;gt;= 500' measure instead of refering to the 'Final Cost Amount' measure (which simply is a sum of final cost amount). This to avoid confusion&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 09:01:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271191#M55298</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-07T09:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Count if measure returns true - error with total value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271212#M55299</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;In the formula, try to use the measure&amp;nbsp;&lt;SPAN&gt;[Final Cost Amount] directly, but not&amp;nbsp;SUM(FactControlReportsALL[Final_Cost_Amount])&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards,&lt;BR /&gt;Community Support Team _ kalyj&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 09:12:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271212#M55299</guid>
      <dc:creator>v-yanjiang-msft</dc:creator>
      <dc:date>2022-01-07T09:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: Count if measure returns true - error with total value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271241#M55300</link>
      <description>&lt;P&gt;It worked ! Thanks !&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":hugging_face:"&gt;🤗&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;But I don't understand what is the difference between refering to another measure (which works) and includind the calculation in the measure itself (not working)?&lt;/P&gt;&lt;P&gt;As in both cases it is the same calculation? Could you explain?&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 09:28:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271241#M55300</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-07T09:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: Count if measure returns true - error with total value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271267#M55301</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;It's my pleasure! In this formula maybe because the ADDCOLUMN function, it means create a new table in the measure, you can refer to this artical.&lt;/P&gt;
&lt;P&gt;Reference:&lt;A href="https://docs.microsoft.com/en-us/dax/addcolumns-function-dax" target="_blank"&gt;ADDCOLUMNS function (DAX) - DAX | Microsoft Docs&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Community Support Team _ kalyj&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 09:43:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-measure-returns-true-error-with-total-value/m-p/2271267#M55301</guid>
      <dc:creator>v-yanjiang-msft</dc:creator>
      <dc:date>2022-01-07T09:43:19Z</dc:date>
    </item>
  </channel>
</rss>

