<?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: Top Customers in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-Customers/m-p/3995251#M155177</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.&lt;/P&gt;
&lt;P&gt;In my sample, I tried to achieve top 3, and I hope you can reauthor the measure in your sample.&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&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;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sales: = 
SUM( sales[sales])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/window-function-dax?wt.mc_id=DP-MVP-5004989" target="_blank"&gt;WINDOW function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sales top 3: = 
VAR _selectedperiod =
    ALLSELECTED ( 'calendar'[MOnth-Year sort] )
VAR _t =
    ADDCOLUMNS (
        CALCULATETABLE (
            SUMMARIZE (
                ALL ( sales ),
                customer[customer],
                'calendar'[MOnth-Year sort],
                'calendar'[Month-Year]
            ),
            'calendar'[MOnth-Year sort] IN _selectedperiod
        ),
        "@sales", [Sales:]
    )
VAR _group =
    GROUPBY (
        _t,
        customer[customer],
        "@allsales", SUMX ( CURRENTGROUP (), [@sales] )
    )
VAR _toplist =
    SUMMARIZE (
        WINDOW ( 1, ABS, 3, ABS, _group, ORDERBY ( [@allsales], DESC ) ),
        customer[customer]
    )
RETURN
    CALCULATE (
        SUM ( sales[sales] ),
        KEEPFILTERS ( customer[customer] IN _toplist )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Jun 2024 03:34:34 GMT</pubDate>
    <dc:creator>Jihwan_Kim</dc:creator>
    <dc:date>2024-06-17T03:34:34Z</dc:date>
    <item>
      <title>Top Customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-Customers/m-p/3995180#M155172</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What would be the correct measure to show the Top 10 customer over a period of time?&amp;nbsp; Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The resulting ranking is not based on the grand total but based on the total sales for a given month (or column period).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the example below, if there are 500 customers, the measure will show only 16 customers that fall into the TOP 10 customers for the given period which is January to May (on a month-to-month basis)&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2024 02:44:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-Customers/m-p/3995180#M155172</guid>
      <dc:creator>Oros</dc:creator>
      <dc:date>2024-06-17T02:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Top Customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-Customers/m-p/3995251#M155177</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.&lt;/P&gt;
&lt;P&gt;In my sample, I tried to achieve top 3, and I hope you can reauthor the measure in your sample.&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&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;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sales: = 
SUM( sales[sales])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/window-function-dax?wt.mc_id=DP-MVP-5004989" target="_blank"&gt;WINDOW function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sales top 3: = 
VAR _selectedperiod =
    ALLSELECTED ( 'calendar'[MOnth-Year sort] )
VAR _t =
    ADDCOLUMNS (
        CALCULATETABLE (
            SUMMARIZE (
                ALL ( sales ),
                customer[customer],
                'calendar'[MOnth-Year sort],
                'calendar'[Month-Year]
            ),
            'calendar'[MOnth-Year sort] IN _selectedperiod
        ),
        "@sales", [Sales:]
    )
VAR _group =
    GROUPBY (
        _t,
        customer[customer],
        "@allsales", SUMX ( CURRENTGROUP (), [@sales] )
    )
VAR _toplist =
    SUMMARIZE (
        WINDOW ( 1, ABS, 3, ABS, _group, ORDERBY ( [@allsales], DESC ) ),
        customer[customer]
    )
RETURN
    CALCULATE (
        SUM ( sales[sales] ),
        KEEPFILTERS ( customer[customer] IN _toplist )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2024 03:34:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-Customers/m-p/3995251#M155177</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2024-06-17T03:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Top Customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-Customers/m-p/3996552#M155323</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for your quick reply and for taking the time to send a pbix file.&amp;nbsp; I think that you are very close to the intended result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One thing that I noticed is that the 2 tables do not show the top 3 per month.&lt;/P&gt;&lt;P&gt;(we do NOT need the top 3 by grand total)&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;(we need to show all the top 3 customers in a given month.&amp;nbsp; we do NOT need show the customers who have never been in the top 3 in a given month.&amp;nbsp; the ones highlighted in red have never been in the top 3 in any of the given months).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All customers in yellow have been in the top 3 in a given month.&amp;nbsp; Thanks again.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2024 16:07:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-Customers/m-p/3996552#M155323</guid>
      <dc:creator>Oros</dc:creator>
      <dc:date>2024-06-17T16:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Top Customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-Customers/m-p/3996622#M155334</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thank you for your message, and please check the below picture and the attached pbix file whether it suits your requirement.&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;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sales top 3 v2: =
CALCULATE (
    SUM ( sales[sales] ),
    KEEPFILTERS (
        WINDOW (
            1,
            ABS,
            3,
            ABS,
            CALCULATETABLE (
                SUMMARIZE (
                    sales,
                    customer[customer],
                    'calendar'[MOnth-Year sort],
                    'calendar'[Month-Year]
                ),
                REMOVEFILTERS ( customer[customer] )
            ),
            ORDERBY ( CALCULATE ( SUM ( sales[sales] ) ), DESC )
        )
    )
)
&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 17 Jun 2024 16:58:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-Customers/m-p/3996622#M155334</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2024-06-17T16:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Top Customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-Customers/m-p/3997032#M155403</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think that you actually nailed it! How do I show the rest of the numbers like this? I would&amp;nbsp; like to show the non-highlighted numbers, together with the yellow highlighted numbers.&amp;nbsp; Thanks again.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 00:37:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-Customers/m-p/3997032#M155403</guid>
      <dc:creator>Oros</dc:creator>
      <dc:date>2024-06-18T00:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: Top Customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-Customers/m-p/3997320#M155436</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&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;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sales top 3 v3: =
VAR _t =
    ADDCOLUMNS (
        SUMMARIZE (
            ALLSELECTED ( sales ),
            customer[customer],
            'calendar'[MOnth-Year sort],
            'calendar'[Month-Year]
        ),
        "@result",
            CALCULATE (
                SUM ( sales[sales] ),
                KEEPFILTERS (
                    WINDOW (
                        1,
                        ABS,
                        3,
                        ABS,
                        CALCULATETABLE (
                            SUMMARIZE (
                                sales,
                                customer[customer],
                                'calendar'[MOnth-Year sort],
                                'calendar'[Month-Year]
                            ),
                            REMOVEFILTERS ( customer[customer] )
                        ),
                        ORDERBY ( CALCULATE ( SUM ( sales[sales] ) ), DESC )
                    )
                )
            )
    )
VAR _list =
    SUMMARIZE ( FILTER ( _t, [@result] &amp;lt;&amp;gt; BLANK () ), customer[customer] )
RETURN
    CALCULATE ( SUM ( sales[sales] ), KEEPFILTERS ( customer[customer] IN _list ) )
&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 18 Jun 2024 03:30:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-Customers/m-p/3997320#M155436</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2024-06-18T03:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: Top Customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-Customers/m-p/3998511#M155634</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are an absolute Superhero!!!&amp;nbsp; It works!&amp;nbsp; Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 15:05:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-Customers/m-p/3998511#M155634</guid>
      <dc:creator>Oros</dc:creator>
      <dc:date>2024-06-18T15:05:04Z</dc:date>
    </item>
  </channel>
</rss>

