<?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 TopN Customers by Revenue filtered by Region, Country and, Reporting Unit in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-Customers-by-Revenue-filtered-by-Region-Country-and/m-p/111327#M192</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I m new to DAX and Power BI and not able to make out reason for inconsistent result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are slicers for Region, Country and, Reporting Unit in Power BI report and I need to show top 5 customers from TodaysTable data based on the selection made.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table structure:&lt;BR /&gt;HistoryTable - with Region, Country, Reporting Unit, Revenue, &amp;amp; CombinationKey (REG + COUNTRY + RU)&lt;BR /&gt;TodaysTable - with Region, Country, Reporting Unit, Customer, Customer ID, Revenue &amp;amp; CombinationKey (REG + COUNTRY + RU)&lt;BR /&gt;MapTable - Active Relationship, Both directions on CombinationKey - DISTINCT(ALL(HistoryTable [CombinationKey], HistoryTable [Region], HistoryTable [RU], HistoryTable [Country]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created 2 Measures in TodaysTable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Todays Revenue = SUMX(TodaysTable , TodaysTable [Net Order Value])&lt;BR /&gt;Rank of Customer = RANKX(ALLSELECTED(TodaysTable [Customer]),[Todays Revenue],,DESC,DENSE)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and applied filter Rank of Customer &amp;lt;=5 in the report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While this shows the result correctly when I have only Customer and Todays Revenue as columns in the table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if I include Customer ID/ Region/ Country number of results shown just multiplies and I noticed that the Rank is repeating (multiple rows shows up as having Rank 1 while having different Revenues !!!) .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I m unable to understand this behavior.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would be nice if someone could help me with correct DAX expression. that would enable me to show only 5 customers based on max revenue with additional fields (Region, Country, Customer ID).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I would like to know if this can be achieved with a single DAX expression.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&amp;nbsp;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jan 2017 15:24:35 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-01-10T15:24:35Z</dc:date>
    <item>
      <title>TopN Customers by Revenue filtered by Region, Country and, Reporting Unit</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-Customers-by-Revenue-filtered-by-Region-Country-and/m-p/111327#M192</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I m new to DAX and Power BI and not able to make out reason for inconsistent result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are slicers for Region, Country and, Reporting Unit in Power BI report and I need to show top 5 customers from TodaysTable data based on the selection made.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table structure:&lt;BR /&gt;HistoryTable - with Region, Country, Reporting Unit, Revenue, &amp;amp; CombinationKey (REG + COUNTRY + RU)&lt;BR /&gt;TodaysTable - with Region, Country, Reporting Unit, Customer, Customer ID, Revenue &amp;amp; CombinationKey (REG + COUNTRY + RU)&lt;BR /&gt;MapTable - Active Relationship, Both directions on CombinationKey - DISTINCT(ALL(HistoryTable [CombinationKey], HistoryTable [Region], HistoryTable [RU], HistoryTable [Country]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created 2 Measures in TodaysTable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Todays Revenue = SUMX(TodaysTable , TodaysTable [Net Order Value])&lt;BR /&gt;Rank of Customer = RANKX(ALLSELECTED(TodaysTable [Customer]),[Todays Revenue],,DESC,DENSE)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and applied filter Rank of Customer &amp;lt;=5 in the report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While this shows the result correctly when I have only Customer and Todays Revenue as columns in the table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if I include Customer ID/ Region/ Country number of results shown just multiplies and I noticed that the Rank is repeating (multiple rows shows up as having Rank 1 while having different Revenues !!!) .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I m unable to understand this behavior.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would be nice if someone could help me with correct DAX expression. that would enable me to show only 5 customers based on max revenue with additional fields (Region, Country, Customer ID).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I would like to know if this can be achieved with a single DAX expression.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&amp;nbsp;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2017 15:24:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-Customers-by-Revenue-filtered-by-Region-Country-and/m-p/111327#M192</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-01-10T15:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: TopN Customers by Revenue filtered by Region, Country and, Reporting Unit</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-Customers-by-Revenue-filtered-by-Region-Country-and/m-p/117192#M205</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RANKXX function works on what you are grouping by&lt;/P&gt;&lt;P&gt;When you say&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Rank of Customer = RANKX(ALLSELECTED(TodaysTable [Customer]),[Todays Revenue],,DESC,DENSE)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It works based on the Customer. &amp;nbsp;So if you want with&amp;nbsp;CombinationKey (REG + COUNTRY + RU) you have to replace it Customer with this CombinationKey.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Caution this will also report wrong results if your report has separate columns for Region, Country and RU.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The basics is that the any report based on RANKXX should use the same dimension on which the rank is computed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If this answers your issue please accept it as a solution and also give KUDOS.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;CheenuSing&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 04:59:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-Customers-by-Revenue-filtered-by-Region-Country-and/m-p/117192#M205</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-01-23T04:59:15Z</dc:date>
    </item>
  </channel>
</rss>

