<?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: PowerBi dax FILTER, DISTINCT and REMOVEFILTERS in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PowerBi-dax-FILTER-DISTINCT-and-REMOVEFILTERS/m-p/4032153#M159483</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="581764" data-lia-user-login="Tinus1905" class="lia-mention lia-mention-user"&gt;Tinus1905&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In fact, there is no fundamental difference, their results are all the same. Only the variable is used in Measure2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the case of large amounts of data, the use of variables may have some performance benefits.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It depends on your needs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Nono Chen&lt;/P&gt;
&lt;P&gt;If this &lt;STRONG&gt;&lt;EM&gt;post&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;helps, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jul 2024 08:53:01 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-07-09T08:53:01Z</dc:date>
    <item>
      <title>PowerBi dax FILTER, DISTINCT and REMOVEFILTERS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PowerBi-dax-FILTER-DISTINCT-and-REMOVEFILTERS/m-p/4029950#M159319</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im struggling a little bit with DISTINCT and using a FILTER in my measure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Type&amp;nbsp; &amp;nbsp; &amp;nbsp; Option&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;Sale&lt;/TD&gt;&lt;TD&gt;Open&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;Service&lt;/TD&gt;&lt;TD&gt;Used&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;345&lt;/TD&gt;&lt;TD&gt;Sale&lt;/TD&gt;&lt;TD&gt;Closed&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;345&lt;/TD&gt;&lt;TD&gt;Service&lt;/TD&gt;&lt;TD&gt;Closed&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;345&lt;/TD&gt;&lt;TD&gt;Sale&lt;/TD&gt;&lt;TD&gt;Closed&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On my report view I have a couple of slicers and a card.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my measure; First I want to FILTER the column 'Type' to 'Sale', then I want to remove the duplicates on the column 'ID' and then ignore the slicer 'Option' that I have in my report view.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following measure I have;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure1 = CALCULATE(&lt;BR /&gt;DISTINCTCOUNT(tableA[ID]),&lt;BR /&gt;tableA[Type] = "Sale",&lt;BR /&gt;REMOVEFILTERS(tableA[Option]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem with this measure, that's what I expect, is that it first DISTINCTCOUNT the column and the uses a filter?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I uses another measure like this; when I think it first FILTERS the column and then does the&amp;nbsp;DISTINCT.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure2 =&lt;BR /&gt;VAR Filteredtable =&lt;BR /&gt;FILTER(&lt;BR /&gt;tableA,&lt;BR /&gt;tableA[Type] = "Sale")&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;VAR UniqueID =&lt;BR /&gt;DISTINCT(SELECTCOLUMNS(Filteredtable , "ID", tableA[ID]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;COUNTROWS(UniqueID)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem with this measure is, I dont know how to use the REMOVEFILTER in this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So can anyone tell me if Im correct that measure1 is the wrong measure I want to use and that the second measure is the correct one? And if the second one is the correct mneasure, how to get the REMOVEFILTER in it? Or is there a better measure that does the trick?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 10:22:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PowerBi-dax-FILTER-DISTINCT-and-REMOVEFILTERS/m-p/4029950#M159319</guid>
      <dc:creator>Tinus1905</dc:creator>
      <dc:date>2024-07-08T10:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi dax FILTER, DISTINCT and REMOVEFILTERS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PowerBi-dax-FILTER-DISTINCT-and-REMOVEFILTERS/m-p/4029970#M159322</link>
      <description>&lt;P&gt;Remember to adhere to the decorum of the Community Forum when asking a question.&lt;BR /&gt;&lt;BR /&gt;Please provide your work-in-progress Power BI Desktop file (with sensitive information removed) that covers your issue or question completely in a usable format (not as a screenshot). You can upload the PBIX file to a cloud storage service such as OneDrive, Google Drive, Dropbox, or to a Github repository, and then share a file’s URL.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Please show the expected outcome based on the sample data you provided.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523/highlight/true#M607150" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523/highlight/true#M607150&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;This allows members of the Forum to assess the state of the model, report layer, relationships, and any DAX applied.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 10:31:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PowerBi-dax-FILTER-DISTINCT-and-REMOVEFILTERS/m-p/4029970#M159322</guid>
      <dc:creator>foodd</dc:creator>
      <dc:date>2024-07-08T10:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi dax FILTER, DISTINCT and REMOVEFILTERS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PowerBi-dax-FILTER-DISTINCT-and-REMOVEFILTERS/m-p/4031759#M159457</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="581764" data-lia-user-login="Tinus1905" class="lia-mention lia-mention-user"&gt;Tinus1905&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Measure1 is correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For Measure2, I suggest you change it to the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure2 = 
VAR Filteredtable = FILTER(ALL('TableA'), 'TableA'[Type] = "sale")

VAR UniqueID =
    CALCULATE(DISTINCTCOUNT('TableA'[ID]), REMOVEFILTERS('TableA'[Option]), Filteredtable)

RETURN
    UniqueID
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the result.&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;Regards,&lt;/P&gt;
&lt;P&gt;Nono Chen&lt;/P&gt;
&lt;P&gt;If this &lt;STRONG&gt;&lt;EM&gt;post&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;helps, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 06:13:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PowerBi-dax-FILTER-DISTINCT-and-REMOVEFILTERS/m-p/4031759#M159457</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-09T06:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi dax FILTER, DISTINCT and REMOVEFILTERS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PowerBi-dax-FILTER-DISTINCT-and-REMOVEFILTERS/m-p/4031974#M159469</link>
      <description>&lt;P&gt;Thanks. Can you tell me why you should use measure 1 or measure 2? Or is there no difference?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 07:38:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PowerBi-dax-FILTER-DISTINCT-and-REMOVEFILTERS/m-p/4031974#M159469</guid>
      <dc:creator>Tinus1905</dc:creator>
      <dc:date>2024-07-09T07:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi dax FILTER, DISTINCT and REMOVEFILTERS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PowerBi-dax-FILTER-DISTINCT-and-REMOVEFILTERS/m-p/4032153#M159483</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="581764" data-lia-user-login="Tinus1905" class="lia-mention lia-mention-user"&gt;Tinus1905&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In fact, there is no fundamental difference, their results are all the same. Only the variable is used in Measure2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the case of large amounts of data, the use of variables may have some performance benefits.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It depends on your needs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Nono Chen&lt;/P&gt;
&lt;P&gt;If this &lt;STRONG&gt;&lt;EM&gt;post&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;helps, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 08:53:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PowerBi-dax-FILTER-DISTINCT-and-REMOVEFILTERS/m-p/4032153#M159483</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-09T08:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBi dax FILTER, DISTINCT and REMOVEFILTERS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PowerBi-dax-FILTER-DISTINCT-and-REMOVEFILTERS/m-p/4032161#M159484</link>
      <description>&lt;P&gt;Ah, good to know. Thanks for your quick response.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 08:55:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PowerBi-dax-FILTER-DISTINCT-and-REMOVEFILTERS/m-p/4032161#M159484</guid>
      <dc:creator>Tinus1905</dc:creator>
      <dc:date>2024-07-09T08:55:46Z</dc:date>
    </item>
  </channel>
</rss>

