<?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: Ranking by Region/Product Category/SKU in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-Region-Product-Category-SKU/m-p/3477691#M132901</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please have&amp;nbsp; a try.&lt;/P&gt;
&lt;P&gt;Create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rank by Product and Region =
VAR CurrentSKU = Sales[SKU]
VAR CurrentProduct =
    RELATED ( Product[Product] )
VAR CurrentRegion =
    RELATED ( Region[Region] )
RETURN
    RANKX (
        FILTER (
            ALL ( Sales ),
            Sales[SKU] &amp;lt;&amp;gt; BLANK ()
                &amp;amp;&amp;amp; RELATED ( Product[Product] ) = CurrentProduct
                &amp;amp;&amp;amp; RELATED ( Region[Region] ) = CurrentRegion
        ),
        CALCULATE ( SUM ( Sales[Sales] ) )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;BR /&gt;Community Support Team _ Rongtie&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&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>Mon, 16 Oct 2023 02:42:33 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-10-16T02:42:33Z</dc:date>
    <item>
      <title>Ranking by Region/Product Category/SKU</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-Region-Product-Category-SKU/m-p/3473209#M132635</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to write a dax query, something using Rankx and windows function to get a table that will give me rank for each SKU'sales&amp;nbsp; based on the category and region filters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 4 tables linked to each(Sales table linked to Region by location code, Product by SKU and used to calculate the total sales.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to calculate the rank of each SKU by Product and Region and display then in ascending order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ekta&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="42973" data-lia-user-login="Zubair_Muhammad" class="lia-mention lia-mention-user"&gt;Zubair_Muhammad&lt;/a&gt;&amp;nbsp;I saw that you solved a similar problem but it did not work for me. Could you tell me how to go about this one? Would be a great help!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 10:27:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-Region-Product-Category-SKU/m-p/3473209#M132635</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-10-12T10:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking by Region/Product Category/SKU</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-Region-Product-Category-SKU/m-p/3473352#M132641</link>
      <description>&lt;P&gt;To calculate the rank of each SKU's sales based on category and region filters in Power BI using DAX, you can use the RANKX function and FILTER to create the desired table. Here's a step-by-step guide:&lt;/P&gt;&lt;P&gt;Assuming you have the following tables:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Sales&lt;/LI&gt;&lt;LI&gt;Region&lt;/LI&gt;&lt;LI&gt;Product&lt;/LI&gt;&lt;LI&gt;SKU&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;And you want to calculate SKU rank by Product and Region, follow these steps:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Create a calculated table to define the combinations of Product and Region you want to rank by. You can do this in the 'Modeling' tab by going to 'New Table' and entering the DAX formula:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;RankTable = SUMMARIZE(CROSSJOIN(Product, Region), Product[Product], Region[Region])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will create a table with all possible combinations of Product and Region.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Next, create a measure to calculate the rank. In this measure, you will use RANKX to rank SKU sales within the filtered context of Product and Region. Go to 'Modeling' &amp;gt; 'New Measure' and enter the DAX formula:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;SKU Rank =&lt;BR /&gt;RANKX(&lt;BR /&gt;FILTER(&lt;BR /&gt;ALL(Sales),&lt;BR /&gt;Sales[Product] = SELECTEDVALUE(RankTable[Product]) &amp;amp;&amp;amp; Sales[Region] = SELECTEDVALUE(RankTable[Region])&lt;BR /&gt;),&lt;BR /&gt;[Total Sales]&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this measure:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;FILTER is used to apply the filter context of the selected Product and Region from the RankTable.&lt;/LI&gt;&lt;LI&gt;RANKX ranks the SKU sales within the filtered context.&lt;/LI&gt;&lt;LI&gt;[Total Sales] should be replaced with the actual name of your sales column.&lt;/LI&gt;&lt;/UL&gt;&lt;OL&gt;&lt;LI&gt;Finally, create a table visualization and add the SKU, Product, Region, and SKU Rank to the table. Apply your desired filters for Product and Region, and the SKU Rank will be calculated based on these filters.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Make sure that you have proper relationships set up between your tables, and the column names in the DAX formulas match your actual column names.&lt;/P&gt;&lt;P&gt;By following these steps, you should be able to calculate the rank of each SKU's sales based on the selected category (Product) and region filters in ascending order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 11:30:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-Region-Product-Category-SKU/m-p/3473352#M132641</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2023-10-12T11:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking by Region/Product Category/SKU</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-Region-Product-Category-SKU/m-p/3473419#M132653</link>
      <description>&lt;P&gt;hello, could you tell me which column are we referring to as Sales[Prodcut]?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Sales[Product]&lt;/STRONG&gt; = SELECTEDVALUE(RankTable[Product]) &amp;amp;&amp;amp; Sales[Region]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The sales table has SKU is linked to the product table with this SKU..&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 11:56:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-Region-Product-Category-SKU/m-p/3473419#M132653</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-10-12T11:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking by Region/Product Category/SKU</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-Region-Product-Category-SKU/m-p/3473502#M132659</link>
      <description>&lt;P&gt;Got it, but it did not work, it's displaying 1 everywhere&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 12:48:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-Region-Product-Category-SKU/m-p/3473502#M132659</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-10-12T12:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking by Region/Product Category/SKU</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-Region-Product-Category-SKU/m-p/3477691#M132901</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please have&amp;nbsp; a try.&lt;/P&gt;
&lt;P&gt;Create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rank by Product and Region =
VAR CurrentSKU = Sales[SKU]
VAR CurrentProduct =
    RELATED ( Product[Product] )
VAR CurrentRegion =
    RELATED ( Region[Region] )
RETURN
    RANKX (
        FILTER (
            ALL ( Sales ),
            Sales[SKU] &amp;lt;&amp;gt; BLANK ()
                &amp;amp;&amp;amp; RELATED ( Product[Product] ) = CurrentProduct
                &amp;amp;&amp;amp; RELATED ( Region[Region] ) = CurrentRegion
        ),
        CALCULATE ( SUM ( Sales[Sales] ) )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;BR /&gt;Community Support Team _ Rongtie&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&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>Mon, 16 Oct 2023 02:42:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-Region-Product-Category-SKU/m-p/3477691#M132901</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-10-16T02:42:33Z</dc:date>
    </item>
  </channel>
</rss>

