<?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: Rank based on two columns in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-based-on-two-columns/m-p/2240779#M53642</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92006" data-lia-user-login="joshua1990" class="lia-mention lia-mention-user"&gt;joshua1990&lt;/a&gt;&amp;nbsp; do I understand that if Rank2 =1 then that Product is Ranked 1 in Rank Total and rest of the products need to be Ranked again as per Rank1?&lt;/P&gt;</description>
    <pubDate>Wed, 15 Dec 2021 17:53:26 GMT</pubDate>
    <dc:creator>smpa01</dc:creator>
    <dc:date>2021-12-15T17:53:26Z</dc:date>
    <item>
      <title>Rank based on two columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-based-on-two-columns/m-p/2240333#M53605</link>
      <description>&lt;P&gt;Hi experts!&lt;/P&gt;&lt;P&gt;I know, there have been a lot of posts regarding this, but they have not been useful for me.&lt;/P&gt;&lt;P&gt;The objective is to have a ranking based on two columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dimension table (Table Dim) that lists all of our products.&lt;/P&gt;&lt;P&gt;Then I have a table (Table Trans) that some transactional values in different columns.&lt;/P&gt;&lt;P&gt;There is the first column called Column1 and another one called Column2.&lt;/P&gt;&lt;P&gt;Now I would like to build a ranking for each product based on Column2 as the first priority and Column1 as the second priority.&lt;/P&gt;&lt;P&gt;Using this DAX Measure I get the ranking for each column:&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;Rank1 =
    RANKX ( ALLSELECTED ( 'Table Dim'[Product] ), [Column1] )&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Rank2 =
    RANKX ( ALLSELECTED ( 'Table Dim'[Product] ), [Column2] )&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a result, now I have the following:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Product&lt;/TD&gt;&lt;TD&gt;Rank1&lt;/TD&gt;&lt;TD&gt;Rank2&lt;/TD&gt;&lt;TD&gt;Rank Total&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A5&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A3&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A4&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A2&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;5&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;The Rank Total column shows the result that I need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How is this possible using DAX?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 13:32:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-based-on-two-columns/m-p/2240333#M53605</guid>
      <dc:creator>joshua1990</dc:creator>
      <dc:date>2021-12-15T13:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: Rank based on two columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-based-on-two-columns/m-p/2240343#M53610</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92006" data-lia-user-login="joshua1990" class="lia-mention lia-mention-user"&gt;joshua1990&lt;/a&gt; , Need some data to suggest for column1 and column 2. If they are numbers&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rank1 =
    RANKX ( ALLSELECTED ( 'Table Dim'[Product] ), [Column1]+ [Column2] )


Rank1 =
    RANKX ( ALLSELECTED ( 'Table Dim'[Product] ),calculate( [Column1]+ [Column2] ) ) &lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 15 Dec 2021 13:36:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-based-on-two-columns/m-p/2240343#M53610</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-12-15T13:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Rank based on two columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-based-on-two-columns/m-p/2240556#M53618</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92006" data-lia-user-login="joshua1990" class="lia-mention lia-mention-user"&gt;joshua1990&lt;/a&gt;&amp;nbsp; the logic for RankTotal is not clear. Please bare more details as to how you arrived there?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 15:31:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-based-on-two-columns/m-p/2240556#M53618</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2021-12-15T15:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Rank based on two columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-based-on-two-columns/m-p/2240575#M53619</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="24978" data-lia-user-login="smpa01" class="lia-mention lia-mention-user"&gt;smpa01&lt;/a&gt;: Thanks for your reply.&lt;/P&gt;&lt;P&gt;First, the Rank Total is based on the numerical value in Rank2. Then all remaining products are based on Rank1.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 15:46:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-based-on-two-columns/m-p/2240575#M53619</guid>
      <dc:creator>joshua1990</dc:creator>
      <dc:date>2021-12-15T15:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Rank based on two columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-based-on-two-columns/m-p/2240578#M53620</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92006" data-lia-user-login="joshua1990" class="lia-mention lia-mention-user"&gt;joshua1990&lt;/a&gt;&amp;nbsp;New answers to this aren't likely to be much more useful than these older ones unless you can explain what you tried, what your code was, and what your result was. Then we can help fix it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise, please see these:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/How-to-Rank-a-list-based-on-2-values-double-rankX/m-p/44008" target="_blank" rel="noopener"&gt;https://community.powerbi.com/t5/Desktop/How-to-Rank-a-list-based-on-2-values-double-rankX/m-p/44008&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Ranking-based-on-multiple-criteria/m-p/892072" target="_blank" rel="noopener"&gt;https://community.powerbi.com/t5/Desktop/Ranking-based-on-multiple-criteria/m-p/892072&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/rankx-on-multiple-columns-with-dax-and-power-bi/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.sqlbi.com/articles/rankx-on-multiple-columns-with-dax-and-power-bi/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures" target="_blank" rel="nofollow noopener noreferrer"&gt;https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 15:47:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-based-on-two-columns/m-p/2240578#M53620</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-12-15T15:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: Rank based on two columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-based-on-two-columns/m-p/2240779#M53642</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92006" data-lia-user-login="joshua1990" class="lia-mention lia-mention-user"&gt;joshua1990&lt;/a&gt;&amp;nbsp; do I understand that if Rank2 =1 then that Product is Ranked 1 in Rank Total and rest of the products need to be Ranked again as per Rank1?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 17:53:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-based-on-two-columns/m-p/2240779#M53642</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2021-12-15T17:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Rank based on two columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-based-on-two-columns/m-p/2247015#M53965</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92006" data-lia-user-login="joshua1990" class="lia-mention lia-mention-user"&gt;joshua1990&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are your Rank1 and Rank2 calculated columns or measures? There are differences between the two, please refer to&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/" target="_blank" rel="noopener"&gt; Calculated Columns and Measures in DAX - SQLBI&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide some sample data, which will help me create the correct formula.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For now, you can refer to this &lt;A href="https://community.powerbi.com/t5/Desktop/Return-the-last-5-by-double-filters/td-p/1311867" target="_blank" rel="noopener"&gt;post&lt;/A&gt; to try to solve it.&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;Stephen Tao&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 08:01:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-based-on-two-columns/m-p/2247015#M53965</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-20T08:01:24Z</dc:date>
    </item>
  </channel>
</rss>

