<?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: Help with DAX - Getting names of top 3 countries for a selected customer and week into variables in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DAX-Getting-names-of-top-3-countries-for-a-selected/m-p/2885226#M93497</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please check if there is a problem in the rankx formula where the text type and text number are compared together.&lt;/P&gt;
&lt;P&gt;You can refer to the following documents that may be helpful to you:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/rankx-function-dax" target="_blank" rel="noopener"&gt;RANKX function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You can refer to the following documents that may be helpful to you:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Rank-customer-over-Date-table-for-various-slicer/m-p/2288699" target="_blank"&gt;Solved: Rank customer over Date table for various slicer - Microsoft Power BI Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/DAX-Commands-and-Tips/TOP-10-countries-using-DAX-code/m-p/2531124" target="_blank"&gt;Solved: TOP 10 countries using DAX code - Microsoft Power BI Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Top-and-Bottom-3-Ranked-Countries-From-Selected-Country-by-GDP/m-p/182422" target="_blank"&gt;Solved: Top and Bottom 3 Ranked Countries From Selected Co... - Microsoft Power BI Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the above one can't help you get the desired result, please provide some&amp;nbsp;&lt;STRONG&gt;sample data&lt;/STRONG&gt;&amp;nbsp;in your tables (&lt;STRONG&gt;exclude&amp;nbsp;sensitive&amp;nbsp;data&lt;/STRONG&gt;) with&amp;nbsp;&lt;STRONG&gt;Text&lt;/STRONG&gt;&amp;nbsp;format and your&amp;nbsp;&lt;STRONG&gt;expected result&lt;/STRONG&gt;&amp;nbsp;with backend logic and special examples.&amp;nbsp;&lt;STRONG&gt;It is better&lt;/STRONG&gt;&amp;nbsp;if you can share a&amp;nbsp;&lt;STRONG&gt;simplified&lt;/STRONG&gt;&amp;nbsp;pbix file.&amp;nbsp;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Nov 2022 10:06:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-11-04T10:06:38Z</dc:date>
    <item>
      <title>Help with DAX - Getting names of top 3 countries for a selected customer and week into variables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DAX-Getting-names-of-top-3-countries-for-a-selected/m-p/2883064#M93381</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am trying to create a summary card on a report.&lt;/P&gt;&lt;P&gt;The overall structure of the summary will be as follows:&lt;/P&gt;&lt;P&gt;"[31%] of the total orders were from [United States] with a total order value of [$139k] and average order value of [$100]. The 2nd highest was [Canada] with order value of [$98k]([16%]) with an average order value of [$86]."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I want to calculate the values above in [ ] into variables and then create a DAX to concatenate everyting. These values will change with the user selecting a a Customer and the Week Number from slicers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I am having trouble calculating the names of the Top 3 countries into variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the DAX I have come up with, but it is not getting me the results.&lt;/P&gt;&lt;P&gt;Note: [Order Value] is a measure calulating the sum of item price * item qty&lt;/P&gt;&lt;P&gt;I am hoping you guys can help me to create a DAX to get the names of the countries in their respective rank variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CountryRed = 
VAR ClientName = SELECTEDVALUE(Client[Client Name])
VAR Week = SELECTEDVALUE('Calendar'[ISO Week of Year])
VAR CountryR1 = CONCATENATEX(TOPN(3,VALUES(Country[Country Name]),RANKX(ALL(Country[Country Name]),CALCULATETABLE(VALUES(Country[Country Name]),Client[Client Name]=ClientName,'Calendar'[ISO Week of Year]=Week),[Order Value],ASC),ASC),Country[Country Name],",",[Order Value])
VAR CountryR2 =
VAR CountryR3 =
RETURN
CountryR1&lt;/LI-CODE&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>Thu, 03 Nov 2022 14:29:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DAX-Getting-names-of-top-3-countries-for-a-selected/m-p/2883064#M93381</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-03T14:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help with DAX - Getting names of top 3 countries for a selected customer and week into variables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DAX-Getting-names-of-top-3-countries-for-a-selected/m-p/2885226#M93497</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please check if there is a problem in the rankx formula where the text type and text number are compared together.&lt;/P&gt;
&lt;P&gt;You can refer to the following documents that may be helpful to you:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/rankx-function-dax" target="_blank" rel="noopener"&gt;RANKX function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You can refer to the following documents that may be helpful to you:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Rank-customer-over-Date-table-for-various-slicer/m-p/2288699" target="_blank"&gt;Solved: Rank customer over Date table for various slicer - Microsoft Power BI Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/DAX-Commands-and-Tips/TOP-10-countries-using-DAX-code/m-p/2531124" target="_blank"&gt;Solved: TOP 10 countries using DAX code - Microsoft Power BI Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Top-and-Bottom-3-Ranked-Countries-From-Selected-Country-by-GDP/m-p/182422" target="_blank"&gt;Solved: Top and Bottom 3 Ranked Countries From Selected Co... - Microsoft Power BI Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the above one can't help you get the desired result, please provide some&amp;nbsp;&lt;STRONG&gt;sample data&lt;/STRONG&gt;&amp;nbsp;in your tables (&lt;STRONG&gt;exclude&amp;nbsp;sensitive&amp;nbsp;data&lt;/STRONG&gt;) with&amp;nbsp;&lt;STRONG&gt;Text&lt;/STRONG&gt;&amp;nbsp;format and your&amp;nbsp;&lt;STRONG&gt;expected result&lt;/STRONG&gt;&amp;nbsp;with backend logic and special examples.&amp;nbsp;&lt;STRONG&gt;It is better&lt;/STRONG&gt;&amp;nbsp;if you can share a&amp;nbsp;&lt;STRONG&gt;simplified&lt;/STRONG&gt;&amp;nbsp;pbix file.&amp;nbsp;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 10:06:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DAX-Getting-names-of-top-3-countries-for-a-selected/m-p/2885226#M93497</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-04T10:06:38Z</dc:date>
    </item>
  </channel>
</rss>

