<?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: Filter sales on dates where every customer has a recorded purchase in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-sales-on-dates-where-every-customer-has-a-recorded/m-p/2266981#M55005</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , Try measures like &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sales = SUM ( TransactionTable[Value] )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Number of Customers Filtered = calculate(COUNTROWS ( VALUES ( CustomerTable[Customer] ) ), all(CustomerTable) ) &lt;BR /&gt;&lt;BR /&gt;Sales Customer Date= calculate(countx(filter(values(CustomerTable[Customer]), [Sales]&amp;gt;0), [Customer]), allexcept(TransactionTable,CustomerTable[Customer], 'Date'[Date])) &lt;BR /&gt;&lt;BR /&gt;Number of Customers in TransactionTable = countx(filter(addcolumns(summarize(TransactionTable,CustomerTable[Customer], 'Date'[Date]) , "_1", [Sales] ,&lt;BR /&gt;[_2], [Sales Customer Date]), [_2] = [Number of Customers Filtered]),[_1])&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jan 2022 09:18:22 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2022-01-05T09:18:22Z</dc:date>
    <item>
      <title>Filter sales on dates where every customer has a recorded purchase</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-sales-on-dates-where-every-customer-has-a-recorded/m-p/2266944#M54999</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="11450" data-lia-user-login="Amit" class="lia-mention lia-mention-user"&gt;Amit&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a standard model, with a transaction table, a date table and a customer table (10 customers).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need is to calculate sales, but only for days where every customer have a recorded purchase.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That means that if I have no customers selected in my slicer, only sales for days where all 10 customers made a purchase should be filtered, if I select 2 customers in my slicer only sales for days where both these 2 customers made a purchase should be filtered, and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This needs to be done dynamic, so I have so far created the following measures:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Sales = SUM ( TransactionTable[Value] )&lt;/LI&gt;&lt;LI&gt;Number of Customers Filtered = COUNTROWS ( VALUES ( CustomerTable[Customer] ) )&lt;/LI&gt;&lt;LI&gt;Number of Customers in TransactionTable = COUNTROWS ( VALUES ( CustomerTable[Customer] ) )&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;Sales Filtered = &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[Sales]&lt;/SPAN&gt;&lt;SPAN&gt; ,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;'01_FACT_Forecast_SpotPrice'[ValueDateCET]&lt;/SPAN&gt;&lt;SPAN&gt; ) ,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[Number of Customers in TransactionTable]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;[Number of Customers Filtered]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This provides me with the following 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;So far so good, Sales Filtered excludes datetimes where there is only 1 customer (I have choosen 2 customers in this example).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem emerges when I want to add customer as a dimension. Then I only get the total, no split on individual customers:&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;Clearly, my approach is not correct, so any help would be much appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 08:56:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-sales-on-dates-where-every-customer-has-a-recorded/m-p/2266944#M54999</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-05T08:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: Filter sales on dates where every customer has a recorded purchase</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-sales-on-dates-where-every-customer-has-a-recorded/m-p/2266981#M55005</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt; , Try measures like &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sales = SUM ( TransactionTable[Value] )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Number of Customers Filtered = calculate(COUNTROWS ( VALUES ( CustomerTable[Customer] ) ), all(CustomerTable) ) &lt;BR /&gt;&lt;BR /&gt;Sales Customer Date= calculate(countx(filter(values(CustomerTable[Customer]), [Sales]&amp;gt;0), [Customer]), allexcept(TransactionTable,CustomerTable[Customer], 'Date'[Date])) &lt;BR /&gt;&lt;BR /&gt;Number of Customers in TransactionTable = countx(filter(addcolumns(summarize(TransactionTable,CustomerTable[Customer], 'Date'[Date]) , "_1", [Sales] ,&lt;BR /&gt;[_2], [Sales Customer Date]), [_2] = [Number of Customers Filtered]),[_1])&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 09:18:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-sales-on-dates-where-every-customer-has-a-recorded/m-p/2266981#M55005</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-01-05T09:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: Filter sales on dates where every customer has a recorded purchase</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-sales-on-dates-where-every-customer-has-a-recorded/m-p/2267079#M55010</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;, and thank you for a hasty reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The solution did not work unfortunetly. This was 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;OL&gt;&lt;LI&gt;I could not use the ALL function in Number of Customers Filtered (I would only have recieved 10 as a result, not 2 as was filtered).&lt;/LI&gt;&lt;LI&gt;Sales Customer Date seems to generate the exact same result as Number of Customers Filtered&lt;/LI&gt;&lt;LI&gt;Number of Customers in Transaction Table seems to generate the exact same result as previously&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I think the problem lies with my measure "Sales Filtered", which does not seem able to filter Sales correctly in response to dates where Customers Filtered and Number of Customers in Transaction Table is the same (2 in my example, since I filtered on 2 customers).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do you think?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 10:09:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-sales-on-dates-where-every-customer-has-a-recorded/m-p/2267079#M55010</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-05T10:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: Filter sales on dates where every customer has a recorded purchase</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-sales-on-dates-where-every-customer-has-a-recorded/m-p/2267308#M55026</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt; , Got lost in this one, we should not include customer in 2nd one &lt;/P&gt;
&lt;P&gt;Sales Customer Date= calculate(countx(filter(values(CustomerTable[Customer]), [Sales]&amp;gt;0), [Customer]), allexcept(Date, 'Date'[Date]))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, means distinct customer on that date&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;Sales Customer Date= calculate(countdistinct(CustomerTable[Customer]), allexcept(Date, 'Date'[Date]))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was using all in first one to get 10, So that we can check for each date we have only 10 customer&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thrid one we can also try like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Number of Customers in TransactionTable = countx(Values('Date'[Date]) ,&lt;BR /&gt;If( [Sales Customer Date] = [Number of Customers Filtered], [Sales], blank()) )&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 12:17:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-sales-on-dates-where-every-customer-has-a-recorded/m-p/2267308#M55026</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-01-05T12:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Filter sales on dates where every customer has a recorded purchase</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-sales-on-dates-where-every-customer-has-a-recorded/m-p/2267457#M55030</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Still no luck.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is that the measure number 4 (Sales Filtered), which is the measure that I need to find the sales on dates where all customer have made a purchase, are able to filter in a "total context", but not in a "subtotal context".&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The matrix shows that values for the second customer is still apperent, even though they are filtered out in the total context. These are the values I need to remove/filter out&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 14:07:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-sales-on-dates-where-every-customer-has-a-recorded/m-p/2267457#M55030</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-05T14:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Filter sales on dates where every customer has a recorded purchase</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-sales-on-dates-where-every-customer-has-a-recorded/m-p/2267760#M55063</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp; provide a sample pbix&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 16:16:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-sales-on-dates-where-every-customer-has-a-recorded/m-p/2267760#M55063</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2022-01-05T16:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: Filter sales on dates where every customer has a recorded purchase</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-sales-on-dates-where-every-customer-has-a-recorded/m-p/2269664#M55201</link>
      <description>&lt;P&gt;I found a solution:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Sales = SUM ( TransactionTable[Value] )&lt;/LI&gt;&lt;LI&gt;Number of Customers Filtered = CALCULATE(&lt;BR /&gt;COUNTROWS (&lt;BR /&gt;VALUES ( &lt;SPAN&gt;CustomerTable[Customer]&lt;/SPAN&gt;&amp;nbsp;)&lt;BR /&gt;) ,&lt;BR /&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ALLSELECTED&lt;/SPAN&gt;&lt;SPAN&gt;( CustomerTable[Customer]&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;Number of Customers in TransactionTable = CALCULATE(&lt;BR /&gt;COUNTROWS (&lt;BR /&gt;VALUES ( TransactionTable[Customer] )&lt;BR /&gt;) ,&lt;BR /&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ALLSELECTED&lt;/SPAN&gt;&lt;SPAN&gt;( CustomerTable[Customer]&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;Sales Filtered =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[Sales]&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;SPAN&gt;&amp;nbsp;Date[Date]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;) ,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[Number of Customers in TransactionTable]&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;=&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;[Number of Customers Filtered]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thank you to everyone for posting&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Thu, 06 Jan 2022 14:58:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-sales-on-dates-where-every-customer-has-a-recorded/m-p/2269664#M55201</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-06T14:58:17Z</dc:date>
    </item>
  </channel>
</rss>

