<?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 Problem with CALCULATE / FILTER in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-CALCULATE-FILTER/m-p/709268#M1002</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I'm trying to produce a table from some simple Sales data in the following format:&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;I'd like to produce a table showing Customer, Number of Sales and "Number of Sales to Major Customers", where "Major Customer" is one who's made more than 50 purchases.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently, only one company (MegaMart)has made more than 50 purchases:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;. but I don't want to hard-doe a filter on Mega MArt, as, in the real world, other companies would beceome "Major Customers" with a few more sales.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So:&amp;nbsp; I created some measures, including one using a filter on count of sales :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Number of Sales = COUNTROWS(Sales)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sales to Major Customers = CALCULATE([Number of Sales],FILTER(Sales,[Number of Sales]&amp;gt;50))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;.. with another "Quick &amp;amp; Dirty" measure to check the numbers are correct&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CheckCount = CALCULATE([Number of Sales],Sales[Customer]="MegaMart Inc")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I haven't got the result I want:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;This suggests that my "Sales to Major Customers" measure is incorrect, but I can't see why. Coudl anyone help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PBI is at&amp;nbsp;&lt;A href="https://1drv.ms/u/s!AmxJyApgEAcYgtU39dbp7CqqPbIK7g" target="_blank"&gt;https://1drv.ms/u/s!AmxJyApgEAcYgtU39dbp7CqqPbIK7g&lt;/A&gt;&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jun 2019 09:00:47 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-06-07T09:00:47Z</dc:date>
    <item>
      <title>Problem with CALCULATE / FILTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-CALCULATE-FILTER/m-p/709268#M1002</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I'm trying to produce a table from some simple Sales data in the following format:&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;I'd like to produce a table showing Customer, Number of Sales and "Number of Sales to Major Customers", where "Major Customer" is one who's made more than 50 purchases.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently, only one company (MegaMart)has made more than 50 purchases:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;. but I don't want to hard-doe a filter on Mega MArt, as, in the real world, other companies would beceome "Major Customers" with a few more sales.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So:&amp;nbsp; I created some measures, including one using a filter on count of sales :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Number of Sales = COUNTROWS(Sales)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sales to Major Customers = CALCULATE([Number of Sales],FILTER(Sales,[Number of Sales]&amp;gt;50))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;.. with another "Quick &amp;amp; Dirty" measure to check the numbers are correct&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CheckCount = CALCULATE([Number of Sales],Sales[Customer]="MegaMart Inc")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I haven't got the result I want:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;This suggests that my "Sales to Major Customers" measure is incorrect, but I can't see why. Coudl anyone help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PBI is at&amp;nbsp;&lt;A href="https://1drv.ms/u/s!AmxJyApgEAcYgtU39dbp7CqqPbIK7g" target="_blank"&gt;https://1drv.ms/u/s!AmxJyApgEAcYgtU39dbp7CqqPbIK7g&lt;/A&gt;&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2019 09:00:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-CALCULATE-FILTER/m-p/709268#M1002</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-07T09:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with CALCULATE / FILTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-CALCULATE-FILTER/m-p/709567#M1022</link>
      <description>&lt;P&gt;Try:&lt;/P&gt;&lt;PRE&gt;Total Purchases &amp;gt;50 = 
CALCULATE(
    [Number of Sales],
    FILTER(
        Customers,
        [Number of Sales] &amp;gt;50
    )
)&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Jun 2019 15:28:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-CALCULATE-FILTER/m-p/709567#M1022</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-07T15:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with CALCULATE / FILTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-CALCULATE-FILTER/m-p/710556#M1046</link>
      <description>&lt;P&gt;Nick&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanksfor the suggestion but it doesn't work. BUT I think I have a clue to the problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I change my Measure to&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Sales to Major Customers = CALCULATE([NumberofSales], FILTER(Customers,[NumberofSales]&amp;gt;20))&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I get:&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;I think the significance of the 27 is that there are &amp;gt; 20 Carrot sales &lt;U&gt;for MegaMart,&lt;/U&gt; but no other sales &amp;gt; 10 for any other customer/product combo:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;If I change my Measure to&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Sales to Major Customers = CALCULATE([NumberofSales], FILTER(Customers,[NumberofSales]&amp;gt;10))&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I get:&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;So, what I think I need to do is to change my&amp;nbsp;measuree&amp;nbsp;so it counts ALL sales for each customer, ignoring&amp;nbsp;the "Product" context. I'm not sure how to do this - maybe use ALL? But how?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 13:25:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-CALCULATE-FILTER/m-p/710556#M1046</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-10T13:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with CALCULATE / FILTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-CALCULATE-FILTER/m-p/710571#M1047</link>
      <description>&lt;P&gt;can you upload some sample data?&amp;nbsp; Onedrive works well&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 13:50:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-CALCULATE-FILTER/m-p/710571#M1047</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-10T13:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with CALCULATE / FILTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-CALCULATE-FILTER/m-p/710674#M1048</link>
      <description>&lt;P&gt;See&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://1drv.ms/u/s!AmxJyApgEAcYgtVy4wwPbgNcc2cYLQ?e=PaEFT3" target="_blank"&gt;https://1drv.ms/u/s!AmxJyApgEAcYgtVy4wwPbgNcc2cYLQ?e=PaEFT3&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Filter Examples" Page&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 16:16:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-CALCULATE-FILTER/m-p/710674#M1048</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-10T16:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with CALCULATE / FILTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-CALCULATE-FILTER/m-p/710707#M1049</link>
      <description>&lt;P&gt;see if this is what you had in mind:&lt;/P&gt;&lt;PRE&gt;Sales to Major Customers = 
SUMX (
       CALCULATETABLE(
           Sales,
            FILTER(
                ADDCOLUMNS(
                    SUMMARIZE(
                        Sales,
                        Customers[Customer]
                    ),
               "Sales by Customer", 
                CALCULATE( 
                    COUNTROWS( Sales), 
                        FILTER( 
                            ALL ( Sales), 
                            Sales[Customer] = EARLIER(Customers[Customer]))
                )
                ),
           [Sales by Customer] &amp;gt; 50
            )
       ),
       [NumberofSales]       
)&lt;/PRE&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 17:11:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-CALCULATE-FILTER/m-p/710707#M1049</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-10T17:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with CALCULATE / FILTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-CALCULATE-FILTER/m-p/710715#M1051</link>
      <description>&lt;P&gt;Nick,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for this, your solution works&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For me, however, it's too complex - I'm a trainer devising some Power BI/DAX training, and I'm struggling to understand how your solution works (I've never used ADDCOLUMN, SUMMARIZE or EARLIER) , so this is probably too advanced an example for a 2 or 3 day day course.&amp;nbsp; I'll devise something simpler,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 17:36:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-CALCULATE-FILTER/m-p/710715#M1051</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-10T17:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with CALCULATE / FILTER</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-CALCULATE-FILTER/m-p/710740#M1053</link>
      <description>&lt;P&gt;It can look overly complex, but if you take it bit-by-bit it's really not that&amp;nbsp; bad. Just remember to work from the inside out. summarize and addcolumns are just a way to make a virtual table, and then I added a column to that table and used that to filter sales since filters are tables. But if this is for an intro type course, you would be better served trying for a simplie example.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 18:05:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-CALCULATE-FILTER/m-p/710740#M1053</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-10T18:05:02Z</dc:date>
    </item>
  </channel>
</rss>

