<?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 Comparing customers sharing same products in their assortment in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-customers-sharing-same-products-in-their-assortment/m-p/1498261#M28907</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to do the following sales analysis:&lt;/P&gt;&lt;P&gt;1. user selects 2 (or more, but for simplicity, let's stick with 2) products with a slicer.&lt;/P&gt;&lt;P&gt;2. visuals filter &lt;STRONG&gt;only&lt;/STRONG&gt; the customers having &lt;STRONG&gt;both&lt;/STRONG&gt; of the products in their assortment.&lt;/P&gt;&lt;P&gt;3. we get the number of customers in which product A sells better, and number in which B sells better.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have managed to do this as a workaround with a filter. However, it only works in a table, when customers are on rows, and not in other visuals (e.g. scatter plot) - so it's hard to compare different customer groups.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My solution below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Create product ranking&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Product rank = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RANKX(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ALLSELECTED('Prod_selection_1v1'[Subbrand + KEG/Btl]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Volume]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Count number of customers where Rank=1&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CountRank1 = SUMX(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VALUES(WSDcalc[Ship-To Party name]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF([Product rank]=1,1,0)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Apply the following filter to the visual, so it filters only customers with &lt;STRONG&gt;both&lt;/STRONG&gt; products sold.&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;#selected_products_filter = IF([#products]=[#products(max)], 1, 0)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;#products = DISTINCTCOUNT('Prod_selection_1v1'[Subbrand + KEG/Btl])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;#products(max) = CALCULATE(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DISTINCTCOUNT('Prod_selection_1v1'[Subbrand + KEG/Btl]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ALLSELECTED(Customers)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, scatter plot shows different number (just as any other visual besides table), because the filter (step 3) doesn't work, which would make a really meanningful analysis here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any help on how to solve this a lot.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Nov 2020 07:58:45 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-11-17T07:58:45Z</dc:date>
    <item>
      <title>Comparing customers sharing same products in their assortment</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-customers-sharing-same-products-in-their-assortment/m-p/1498261#M28907</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to do the following sales analysis:&lt;/P&gt;&lt;P&gt;1. user selects 2 (or more, but for simplicity, let's stick with 2) products with a slicer.&lt;/P&gt;&lt;P&gt;2. visuals filter &lt;STRONG&gt;only&lt;/STRONG&gt; the customers having &lt;STRONG&gt;both&lt;/STRONG&gt; of the products in their assortment.&lt;/P&gt;&lt;P&gt;3. we get the number of customers in which product A sells better, and number in which B sells better.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have managed to do this as a workaround with a filter. However, it only works in a table, when customers are on rows, and not in other visuals (e.g. scatter plot) - so it's hard to compare different customer groups.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My solution below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Create product ranking&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Product rank = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RANKX(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ALLSELECTED('Prod_selection_1v1'[Subbrand + KEG/Btl]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Volume]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Count number of customers where Rank=1&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CountRank1 = SUMX(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VALUES(WSDcalc[Ship-To Party name]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF([Product rank]=1,1,0)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Apply the following filter to the visual, so it filters only customers with &lt;STRONG&gt;both&lt;/STRONG&gt; products sold.&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;#selected_products_filter = IF([#products]=[#products(max)], 1, 0)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;#products = DISTINCTCOUNT('Prod_selection_1v1'[Subbrand + KEG/Btl])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;#products(max) = CALCULATE(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DISTINCTCOUNT('Prod_selection_1v1'[Subbrand + KEG/Btl]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ALLSELECTED(Customers)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, scatter plot shows different number (just as any other visual besides table), because the filter (step 3) doesn't work, which would make a really meanningful analysis here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any help on how to solve this a lot.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 07:58:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-customers-sharing-same-products-in-their-assortment/m-p/1498261#M28907</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-17T07:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing customers sharing same products in their assortment</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-customers-sharing-same-products-in-their-assortment/m-p/1498433#M28910</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , The 2nd , customer who buys both product &lt;/P&gt;
&lt;P&gt;measure =&lt;BR /&gt;var _all = calculate(distinctcount(Prod_selection_1v1[Product]) ,allselected(Prod_selection_1v1))&lt;BR /&gt;return &lt;BR /&gt;countx(filter(summarize(Customers, Customers[Customers ID],"_1" ,distinctcount(Prod_selection_1v1[Product])), [_1] = _all),[Customers])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for the third one have the rank of distinct count of customer on all selected product&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 08:49:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-customers-sharing-same-products-in-their-assortment/m-p/1498433#M28910</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-11-17T08:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing customers sharing same products in their assortment</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-customers-sharing-same-products-in-their-assortment/m-p/1498444#M28911</link>
      <description>&lt;P&gt;Hi Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- What would you want the scatter plot to show exactly? I get lost there. Since you mention that your approach works on the table visual, can you explain what info from the table visual you show would need to be on the scattered plot and how it should be shown?&lt;/P&gt;
&lt;P&gt;- Is all that you show on the rows of the visual measures (Volume, #Customers...)&lt;/P&gt;
&lt;P&gt;- Can you by any chance share the pbix (by PM if necessary)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&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;</description>
      <pubDate>Tue, 17 Nov 2020 08:51:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-customers-sharing-same-products-in-their-assortment/m-p/1498444#M28911</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-11-17T08:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing customers sharing same products in their assortment</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-customers-sharing-same-products-in-their-assortment/m-p/1499046#M28924</link>
      <description>&lt;P&gt;Hi, &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Table is good enough for a total level, however it's difficult to compare customer groups.&lt;/P&gt;&lt;P&gt;On the scatter plot I would like to have, as one quick example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;- X - CountRank1 (count of customers where Product Rank = 1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;- Y - any other measure, e.g. Volume;&lt;/P&gt;&lt;P&gt;&amp;nbsp;- Details: Product;&lt;/P&gt;&lt;P&gt;&amp;nbsp;- Legend: customer group (e.g. customer segment, customer location, etc).&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;In that way it would be a lot easier to compare customer groups compared to a table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. For the table, yes - but everything else works fine as well. For scatter plot, though, the result is not as desired, because my workaround filter doesn't work and I get the numbers for all the customers (not only the ones with both products in their assortment).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Unfortunately I cannot, but if we don't manage to work out the solution without it, I'll try to recreate a similiar pbix.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 11:18:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-customers-sharing-same-products-in-their-assortment/m-p/1499046#M28924</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-17T11:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing customers sharing same products in their assortment</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-customers-sharing-same-products-in-their-assortment/m-p/1499081#M28927</link>
      <description>&lt;P&gt;Hi, &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; ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've spent good 30+ minutes exploring your suggestion, but I couldn't make it work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It correctly gives me the number of Customer Count, where both Products are sold. However, the formula won't work once it's getting sliced by a product.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result that I'm seeking is:&lt;/P&gt;&lt;P&gt;Let's say we have 1000 customers. But only 100 of them have both Product A and B in their assortment. What I need to see is: e.g. Product A sells better (has higher Volume) in 70 (70%) of the customers, and Product B sells better in 30 (30%) of the customers. As in the table rows above (which worked with an extra filter on the visual), but I'd need to see it in a scatter plot instead.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 11:28:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-customers-sharing-same-products-in-their-assortment/m-p/1499081#M28927</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-17T11:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing customers sharing same products in their assortment</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-customers-sharing-same-products-in-their-assortment/m-p/1499163#M28937</link>
      <description>&lt;P&gt;Hi again, &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; , &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to recreate the problem in a new pbix with random numbers, but somehow I don't succed, even though I'm copying everything - can't find what's different in my data model.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I reckon it could be even more clear starting from scratch. Please find my screenshot below with the problem, the logic and the desired result.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, please find this pbix file in the link below.&lt;/P&gt;&lt;P&gt;&lt;A href="https://gofile.io/d/0MQJ51" target="_blank"&gt;https://gofile.io/d/0MQJ51&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 12:12:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-customers-sharing-same-products-in-their-assortment/m-p/1499163#M28937</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-17T12:12:58Z</dc:date>
    </item>
  </channel>
</rss>

