<?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: How to show number of customers per &amp;quot;Sales Group&amp;quot; in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-number-of-customers-per-quot-Sales-Group-quot/m-p/3213804#M117280</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;I cannot think of anything other than the data type. Would you please double check (again) from the query editor that the both low and high limits are of whole number data type.&lt;/P&gt;
&lt;P&gt;Who said you cannot use SWITCH?! However, FILTER is by far the most simple&amp;nbsp;solution.&lt;/P&gt;</description>
    <pubDate>Mon, 01 May 2023 13:48:31 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2023-05-01T13:48:31Z</dc:date>
    <item>
      <title>How to show number of customers per "Sales Group"</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-number-of-customers-per-quot-Sales-Group-quot/m-p/3212749#M117220</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to create a visual, showing in the y axis the different (ideally dynamically created) groups/bins of sales and the in x axis, the number of (unique) customers that belong to the respective group as per the selections of the user (months, countries, products) An example of the final visual is this screenshot below:&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am facing 2 main issues and I would like your support:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Since I have created the intervals (groups of sales) in my Fact table (where I have my measure: Sales),&amp;nbsp;with the addition of a new column and using the switch function, unfortunately I show only the customers with at least 1 sale, meaning I exclude all customers with no sales.&amp;nbsp; As it makes sense of course, my Fact table doesn't show all customers and I need also to show customers with 0 sales. (I have tried to use my "Customers" table, but no success so far, since it always shows all customers allocated to each group).&lt;/LI&gt;&lt;LI&gt;The most important issue is I cannot show only 1 customer per product/period. My DAX formula for my measure is the following:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;# Customers =&lt;BR /&gt;VAR LastMonth = DATESMTD(DATEADD('Date'[Date],-1,MONTH))&lt;BR /&gt;VAR Customers = CALCULATE(DISTINCTCOUNT(Fact[Customer_ID]), 'Date'[Date] &amp;gt; LastMonth)&lt;BR /&gt;Return Customers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So this creates an issue, as per period/product there will be only one group assigned to every&amp;nbsp;Customer_ID, but I want to show the total value and then to assign it to the respective group of sales. This is what I get when for example I select only ONE customer and 2 products and 2 periods with different values:&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to use group by/summarize to take the total Sales by product/period but again I don't get the correct outcome.&lt;/P&gt;&lt;P&gt;I am definitely missing something but still cannot find it...&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;Any feedback would be greatly appreciated. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Apr 2023 12:21:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-number-of-customers-per-quot-Sales-Group-quot/m-p/3212749#M117220</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-30T12:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to show number of customers per "Sales Group"</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-number-of-customers-per-quot-Sales-Group-quot/m-p/3212833#M117229</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;manually create a table (Groups) that contains&lt;/P&gt;
&lt;P&gt;[Group Name] (0 Sales, 3 Sales, 5 - 10 Sales etc..),&lt;/P&gt;
&lt;P&gt;[Index] (For sorting),&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[Lower Limit] (0, 3, 5, etc)&lt;/P&gt;
&lt;P&gt;[&lt;SPAN&gt;Higher Limit] (0, 3, 10, etc)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Place Groups[Group Name] in the table visual along with the following measure&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;# Customers =
COUNTROWS (
    FILTER (
        CROSSJOIN ( Groups, VALUES ( Customer[Customer_ID] ) ),
        VAR NumOfSales =
            COUNTROWS ( CALCULATETABLE ( Fact ) )
        RETURN
            NumOfSales &amp;gt;= Groups[Lower Limit]
                &amp;amp;&amp;amp; NumOfSales &amp;lt;= Groups[Higher Limit]
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 13:52:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-number-of-customers-per-quot-Sales-Group-quot/m-p/3212833#M117229</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-05-01T13:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to show number of customers per "Sales Group"</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-number-of-customers-per-quot-Sales-Group-quot/m-p/3212976#M117235</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp; many thanks for your quick reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used your solution, and I created the Groups table and the measure "# Customers" as suggested :&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the outcome again is not what I want, since it shows all customers assigned to all groups:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea what is missing? Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 30 Apr 2023 21:08:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-number-of-customers-per-quot-Sales-Group-quot/m-p/3212976#M117235</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-30T21:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to show number of customers per "Sales Group"</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-number-of-customers-per-quot-Sales-Group-quot/m-p/3213129#M117243</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just noticed the mistake. I have fixed the code in the original post.&amp;nbsp;&lt;BR /&gt;however, ot seems that you missed to conver the data type of the two limt columns to whole number.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 02:52:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-number-of-customers-per-quot-Sales-Group-quot/m-p/3213129#M117243</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-05-01T02:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to show number of customers per "Sales Group"</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-number-of-customers-per-quot-Sales-Group-quot/m-p/3213486#M117263</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;, thanks again for your response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I converted the data type of limit columns and I updated the DAX as suggested and now the output is very close to the solution but unfortunately still not 100% correct after the validation I did.&lt;/P&gt;&lt;P&gt;The good thing is that now I am able to show all customers (including these with 0 sales - so that already solves my 1st issue) but the customers are not properly allocated to groups:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;For example, if I select one customer, I see that is assigned to one group only, which is fine, but the group is not the correct one. Please see below screenshot:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The total Sales are 42 but the customer belongs to group "6-10 sales", while it should be in "31-50 sales" (I haven't done any selection, meaning I show all products &amp;amp; all months). I see we don't use the the Sales measure in the DAX formula, shall we add it to change the logic based on how we create the groups?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FYI the group names have been manually added to "Group" table, using Power Query and "Enter Data", since it's a new table and I cannot use the switch function with my Sales measure, as I used in my previous implementation in the Fact table. Is this the correct way? Thanks again!&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 09:38:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-number-of-customers-per-quot-Sales-Group-quot/m-p/3213486#M117263</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-01T09:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to show number of customers per "Sales Group"</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-number-of-customers-per-quot-Sales-Group-quot/m-p/3213804#M117280</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I cannot think of anything other than the data type. Would you please double check (again) from the query editor that the both low and high limits are of whole number data type.&lt;/P&gt;
&lt;P&gt;Who said you cannot use SWITCH?! However, FILTER is by far the most simple&amp;nbsp;solution.&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 13:48:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-number-of-customers-per-quot-Sales-Group-quot/m-p/3213804#M117280</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-05-01T13:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to show number of customers per "Sales Group"</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-number-of-customers-per-quot-Sales-Group-quot/m-p/3215754#M117406</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;, I accepted your solution, since I found the issue and I fixed it. I had to change the expression of "NumOfSales" variable, since I want to get the Sum of Sales and not the count of rows, but he rest is fine and now it works perfectly.&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 13:39:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-number-of-customers-per-quot-Sales-Group-quot/m-p/3215754#M117406</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-02T13:39:08Z</dc:date>
    </item>
  </channel>
</rss>

