<?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: Get a histogram of customers grouped by total sales volume (sum of all order quantities) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-histogram-of-customers-grouped-by-total-sales-volume-sum/m-p/3612857#M139674</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="668047" data-lia-user-login="hamslice" class="lia-mention lia-mention-user"&gt;hamslice&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Assuming you have [Customer] and [Quantity] columns in your original table, I could propose to create an additional table and then use it for the resulting histogram.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;In plain text:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table = 
ADDCOLUMNS ( 
    SUMMARIZE ( Data, Data[Customer], "Sum of Qty", SUM ( Data[Quantity] ) ),
    "Category",
    SWITCH ( TRUE (),
             [Sum of Qty] &amp;lt;= 5, "1-5",
             [Sum of Qty] &amp;lt;= 20, "6-20",
             [Sum of Qty] &amp;lt;= 50, "21-50",
             [Sum of Qty] &amp;lt;= 100, "51-100",
             "&amp;gt;100" ) )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;Best Regards, &lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;Alexander&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;A href="https://youtube.com/@powerbi-vlog" target="_blank"&gt;My YouTube vlog in English&lt;/A&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;A href="https://youtube.com/@pbi-vlog" target="_blank"&gt;My YouTube vlog in Russian&lt;/A&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jan 2024 10:10:19 GMT</pubDate>
    <dc:creator>barritown</dc:creator>
    <dc:date>2024-01-03T10:10:19Z</dc:date>
    <item>
      <title>Get a histogram of customers grouped by total sales volume (sum of all order quantities)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-histogram-of-customers-grouped-by-total-sales-volume-sum/m-p/3611408#M139610</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm really struggling to get binning/grouping/tables etc to work, so would appreciate some guidance on doing the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'm trying (and failing) to do is get a count of the number of customer whose total quantity is, say, &amp;lt;5 or &amp;gt;100, or between 6 and 20... etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I already have the Sum of Quantity by Customer, available as a table/histogram or whatever. I've been able to create a 'count of customer by quantity' histogram, which I thought would be exactly what I need, but it appears to have evaluated the count of the number of orders of a particular quantity. I'm not interested in the orders, only the total number of units sold to them over a given period of time (currently looking at all time).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Customer&lt;/TD&gt;&lt;TD&gt;Quantity (sum of)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Customer A&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Customer B&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Customer C&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Customer D&lt;/TD&gt;&lt;TD&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Customer E&lt;/TD&gt;&lt;TD&gt;60&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Customer F&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;20&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Customer G&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;9&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Customer H&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;71&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Customer J&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;4&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Customer K&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;121&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm thinking of binning the quantities as follows:&lt;/P&gt;&lt;P&gt;1-5&lt;/P&gt;&lt;P&gt;6-20&lt;/P&gt;&lt;P&gt;21-50&lt;/P&gt;&lt;P&gt;51-100&lt;/P&gt;&lt;P&gt;&amp;gt;100.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;E.g. there are 3 customers with sales of 1-5 units in the table above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be much appreciated. I've seen some similar queries trying to do a similar thing on count of orders, but not the sum of units from all of those orders, and have failed to adapt for my needs.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 16:17:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-histogram-of-customers-grouped-by-total-sales-volume-sum/m-p/3611408#M139610</guid>
      <dc:creator>hamslice</dc:creator>
      <dc:date>2024-01-02T16:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: Get a histogram of customers grouped by total sales volume (sum of all order quantities)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-histogram-of-customers-grouped-by-total-sales-volume-sum/m-p/3612847#M139673</link>
      <description>&lt;P&gt;Hi&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="668047" data-lia-user-login="hamslice" class="lia-mention lia-mention-user"&gt;hamslice&lt;/a&gt;&amp;nbsp;,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here some steps that I want to share, you can check them if they suitable for your requirement.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Here is my test data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;1.Create a calculate column&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Range =
VAR temp =
    CALCULATE (
        SUM ( 'Table'[Quantity (sum of)] ),
        'Table'[Customer] = 'Table'[Customer]
    )
RETURN
    IF (
        temp &amp;lt;= 5,
        "1-5",
        IF (
            AND ( temp &amp;gt; 5, temp &amp;lt;= 20 ),
            "6-20",
            IF (
                AND ( temp &amp;gt; 20, temp &amp;lt;= 50 ),
                "21-50",
                IF ( AND ( temp &amp;gt; 50, temp &amp;lt;= 100 ), "51-100", "&amp;gt;100" )
            )
        )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;2. &lt;SPAN&gt;Use Range column as X-axis and Customer column as Y-axis&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;3.Final output&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;Best Regards,&lt;/P&gt;
&lt;P&gt;Albert He&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>Wed, 03 Jan 2024 10:07:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-histogram-of-customers-grouped-by-total-sales-volume-sum/m-p/3612847#M139673</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-03T10:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Get a histogram of customers grouped by total sales volume (sum of all order quantities)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-histogram-of-customers-grouped-by-total-sales-volume-sum/m-p/3612857#M139674</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="668047" data-lia-user-login="hamslice" class="lia-mention lia-mention-user"&gt;hamslice&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Assuming you have [Customer] and [Quantity] columns in your original table, I could propose to create an additional table and then use it for the resulting histogram.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;In plain text:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table = 
ADDCOLUMNS ( 
    SUMMARIZE ( Data, Data[Customer], "Sum of Qty", SUM ( Data[Quantity] ) ),
    "Category",
    SWITCH ( TRUE (),
             [Sum of Qty] &amp;lt;= 5, "1-5",
             [Sum of Qty] &amp;lt;= 20, "6-20",
             [Sum of Qty] &amp;lt;= 50, "21-50",
             [Sum of Qty] &amp;lt;= 100, "51-100",
             "&amp;gt;100" ) )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;Best Regards, &lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;Alexander&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;A href="https://youtube.com/@powerbi-vlog" target="_blank"&gt;My YouTube vlog in English&lt;/A&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;A href="https://youtube.com/@pbi-vlog" target="_blank"&gt;My YouTube vlog in Russian&lt;/A&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2024 10:10:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-a-histogram-of-customers-grouped-by-total-sales-volume-sum/m-p/3612857#M139674</guid>
      <dc:creator>barritown</dc:creator>
      <dc:date>2024-01-03T10:10:19Z</dc:date>
    </item>
  </channel>
</rss>

