<?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 Help needed with COUNTIF in DAX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-with-COUNTIF-in-DAX/m-p/2158737#M49901</link>
    <description>&lt;P&gt;All&lt;/P&gt;&lt;P&gt;Problem:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to allocate the discount to invoice line items, but there are cases when the discount is credited in separate credit memo and has only one invoice line as a result. Then I need to make sure that those lines will be summarized in my column called "AdjustedAmountInvoiceLineItem" using countif function. I tried several DAX commands like COUNT, COUNTA, COUNTROWS in combination with FILTER, ALL, ALLEXCEPT to no avail so far.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Discount&lt;/TD&gt;&lt;TD&gt;invoiceNumber&lt;/TD&gt;&lt;TD&gt;serviceMonth&lt;/TD&gt;&lt;TD&gt;Sum of Total&lt;/TD&gt;&lt;TD&gt;AllocatedDiscountperInvoiceLine&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;AdjustedAmountInvoiceLineItem&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;-660&lt;/TD&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;04/2021&lt;/TD&gt;&lt;TD&gt;-660&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;-660&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;-400&lt;/TD&gt;&lt;TD&gt;12478&lt;/TD&gt;&lt;TD&gt;05/2021&lt;/TD&gt;&lt;TD&gt;4000&lt;/TD&gt;&lt;TD&gt;-200&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;3800&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;-200&lt;/TD&gt;&lt;TD&gt;12478&lt;/TD&gt;&lt;TD&gt;05/2021&lt;/TD&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;TD&gt;-50&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1950&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Right now, the value in the last column is zero, but should be -660 EUR.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So this is my current DAX Command:&lt;/P&gt;&lt;P&gt;AdjustedAmountInvoiceLineItem = IF(AND(Table1[Discount]="Discount", Calculate(COUNT,ALLEXCEPT(Table1, Table1[invoiceNumber], Table1[serviceMonth])&amp;gt;1)),0,Table1[Sum of Total]+Table1[AllocatedDiscountPerInvoiceLine])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I get this error message:&lt;/P&gt;&lt;P&gt;The syntax for ',' is incorrect. (DAX(IF(AND(Table1[Discount]="Discount",Calculate(COUNT,ALLEXCEPT(Table1[invoiceNumber], Table1[serviceMonth])&amp;gt;1)),0,Table1[Sum of Total]+Table1[AllocatedDiscountPerInvoiceLine]))).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot see the error and I am not sure if this is the correct DAX command at all.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate all the help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;GracieLee&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Oct 2021 15:47:05 GMT</pubDate>
    <dc:creator>GracieLeeMonroe</dc:creator>
    <dc:date>2021-10-27T15:47:05Z</dc:date>
    <item>
      <title>Help needed with COUNTIF in DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-with-COUNTIF-in-DAX/m-p/2158737#M49901</link>
      <description>&lt;P&gt;All&lt;/P&gt;&lt;P&gt;Problem:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to allocate the discount to invoice line items, but there are cases when the discount is credited in separate credit memo and has only one invoice line as a result. Then I need to make sure that those lines will be summarized in my column called "AdjustedAmountInvoiceLineItem" using countif function. I tried several DAX commands like COUNT, COUNTA, COUNTROWS in combination with FILTER, ALL, ALLEXCEPT to no avail so far.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Discount&lt;/TD&gt;&lt;TD&gt;invoiceNumber&lt;/TD&gt;&lt;TD&gt;serviceMonth&lt;/TD&gt;&lt;TD&gt;Sum of Total&lt;/TD&gt;&lt;TD&gt;AllocatedDiscountperInvoiceLine&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;AdjustedAmountInvoiceLineItem&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;-660&lt;/TD&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;04/2021&lt;/TD&gt;&lt;TD&gt;-660&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;-660&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;-400&lt;/TD&gt;&lt;TD&gt;12478&lt;/TD&gt;&lt;TD&gt;05/2021&lt;/TD&gt;&lt;TD&gt;4000&lt;/TD&gt;&lt;TD&gt;-200&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;3800&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;-200&lt;/TD&gt;&lt;TD&gt;12478&lt;/TD&gt;&lt;TD&gt;05/2021&lt;/TD&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;TD&gt;-50&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1950&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Right now, the value in the last column is zero, but should be -660 EUR.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So this is my current DAX Command:&lt;/P&gt;&lt;P&gt;AdjustedAmountInvoiceLineItem = IF(AND(Table1[Discount]="Discount", Calculate(COUNT,ALLEXCEPT(Table1, Table1[invoiceNumber], Table1[serviceMonth])&amp;gt;1)),0,Table1[Sum of Total]+Table1[AllocatedDiscountPerInvoiceLine])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I get this error message:&lt;/P&gt;&lt;P&gt;The syntax for ',' is incorrect. (DAX(IF(AND(Table1[Discount]="Discount",Calculate(COUNT,ALLEXCEPT(Table1[invoiceNumber], Table1[serviceMonth])&amp;gt;1)),0,Table1[Sum of Total]+Table1[AllocatedDiscountPerInvoiceLine]))).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot see the error and I am not sure if this is the correct DAX command at all.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate all the help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;GracieLee&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Oct 2021 15:47:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-with-COUNTIF-in-DAX/m-p/2158737#M49901</guid>
      <dc:creator>GracieLeeMonroe</dc:creator>
      <dc:date>2021-10-27T15:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed with COUNTIF in DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-with-COUNTIF-in-DAX/m-p/2160590#M49948</link>
      <description>&lt;P&gt;All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;found it, here is the DAX Command I used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF(AND(Table1[Discount]="Discount", Calculate(COUNTROWS(Table1),ALLEXCEPT(Table1,Table1[serviceMonth],Table1[invoiceNumber]))&amp;gt;1),0, Table1[Sum of Total]+Table1[AllocatedDiscountPerInvoiceLine])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a great day!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;GracieLee&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 10:13:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-with-COUNTIF-in-DAX/m-p/2160590#M49948</guid>
      <dc:creator>GracieLeeMonroe</dc:creator>
      <dc:date>2021-10-28T10:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed with COUNTIF in DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-with-COUNTIF-in-DAX/m-p/2165340#M50157</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="334256" data-lia-user-login="GracieLeeMonroe" class="lia-mention lia-mention-user"&gt;GracieLeeMonroe&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Noticed that you have resolved this issue by yourself. Could&amp;nbsp; you please kindly mark your solution to help the other members find it more quickly? Thanks in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-top: 7pt; margin-bottom: 0pt; font-family: 'Segoe UI'; font-size: 11.25pt; color: black;"&gt;&lt;SPAN style="background: white;"&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-top: 7pt; margin-bottom: 0pt; font-family: 'Segoe UI'; font-size: 11.25pt; color: black;"&gt;&lt;SPAN style="background: white;"&gt;Community Support Team _&lt;/SPAN&gt;&lt;SPAN style="background: white;"&gt;Caiyun&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 03:49:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-with-COUNTIF-in-DAX/m-p/2165340#M50157</guid>
      <dc:creator>v-cazheng-msft</dc:creator>
      <dc:date>2021-11-01T03:49:48Z</dc:date>
    </item>
  </channel>
</rss>

