<?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 Convert SQL to Dax (Count Distinct using Join) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Convert-SQL-to-Dax-Count-Distinct-using-Join/m-p/683458#M453</link>
    <description>&lt;P&gt;I want perform follwing sql query operation in Powerbi using Measure. Also i want to filter result of these query based on date using date slicer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Query 1 :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;select distinct( DocNo) from InvoiceHistory where StatusDescription IN ('3-WAY MATCH ERROR')&lt;BR /&gt;and statusid = '9e'&lt;BR /&gt;and ManualProcessingFlag &amp;lt;&amp;gt; '1' and DocNo Not in&lt;BR /&gt;(select distinct(DocNo) from InvoiceHistory where StatusDescription IN ('NEW','SUCCESSFULLY PROCESSED')&lt;BR /&gt;))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried following measure to achieve similar result.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Measure&lt;/STRONG&gt; = CALCULATE(&lt;BR /&gt;DISTINCTCOUNT(InvoiceHistory[DocNo]),&lt;BR /&gt;FILTER((InvoiceHistory), [StatusDescription]="3-WAY MATCH ERROR"&lt;BR /&gt;&amp;amp;&amp;amp; InvoiceHistory[StatusID]="9e"&lt;BR /&gt;&amp;amp;&amp;amp; InvoiceHistory[UpdatedDate] &amp;lt;= max(InvoiceHistory[DocDate])&lt;BR /&gt;&amp;amp;&amp;amp;InvoiceHistory[ManualProcessingFlag]&amp;lt;&amp;gt;1&lt;BR /&gt;&amp;amp;&amp;amp; NOT( (Invoice[DocNo] in&lt;BR /&gt;( CALCULATETABLE&lt;BR /&gt;(DISTINCT(Invoice[DocNo]),&lt;BR /&gt;FILTER((Invoice),(invoice[StatusDescription]="New" || Invoice [StatusDescription] ="SUCCESSFULLY PROCESSED")&lt;BR /&gt;)))))))&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;</description>
    <pubDate>Sat, 04 May 2019 12:42:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-05-04T12:42:08Z</dc:date>
    <item>
      <title>Convert SQL to Dax (Count Distinct using Join)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Convert-SQL-to-Dax-Count-Distinct-using-Join/m-p/683458#M453</link>
      <description>&lt;P&gt;I want perform follwing sql query operation in Powerbi using Measure. Also i want to filter result of these query based on date using date slicer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Query 1 :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;select distinct( DocNo) from InvoiceHistory where StatusDescription IN ('3-WAY MATCH ERROR')&lt;BR /&gt;and statusid = '9e'&lt;BR /&gt;and ManualProcessingFlag &amp;lt;&amp;gt; '1' and DocNo Not in&lt;BR /&gt;(select distinct(DocNo) from InvoiceHistory where StatusDescription IN ('NEW','SUCCESSFULLY PROCESSED')&lt;BR /&gt;))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried following measure to achieve similar result.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Measure&lt;/STRONG&gt; = CALCULATE(&lt;BR /&gt;DISTINCTCOUNT(InvoiceHistory[DocNo]),&lt;BR /&gt;FILTER((InvoiceHistory), [StatusDescription]="3-WAY MATCH ERROR"&lt;BR /&gt;&amp;amp;&amp;amp; InvoiceHistory[StatusID]="9e"&lt;BR /&gt;&amp;amp;&amp;amp; InvoiceHistory[UpdatedDate] &amp;lt;= max(InvoiceHistory[DocDate])&lt;BR /&gt;&amp;amp;&amp;amp;InvoiceHistory[ManualProcessingFlag]&amp;lt;&amp;gt;1&lt;BR /&gt;&amp;amp;&amp;amp; NOT( (Invoice[DocNo] in&lt;BR /&gt;( CALCULATETABLE&lt;BR /&gt;(DISTINCT(Invoice[DocNo]),&lt;BR /&gt;FILTER((Invoice),(invoice[StatusDescription]="New" || Invoice [StatusDescription] ="SUCCESSFULLY PROCESSED")&lt;BR /&gt;)))))))&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;</description>
      <pubDate>Sat, 04 May 2019 12:42:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Convert-SQL-to-Dax-Count-Distinct-using-Join/m-p/683458#M453</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-04T12:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SQL to Dax (Count Distinct using Join)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Convert-SQL-to-Dax-Count-Distinct-using-Join/m-p/684599#M475</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;Please share data in excel using onedrive/google drive to get your answer quickly. Remove any sensitive information before sharing.&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 16:03:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Convert-SQL-to-Dax-Count-Distinct-using-Join/m-p/684599#M475</guid>
      <dc:creator>parry2k</dc:creator>
      <dc:date>2019-05-06T16:03:56Z</dc:date>
    </item>
  </channel>
</rss>

