<?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: Is RANKX the right answer to this problem? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-RANKX-the-right-answer-to-this-problem/m-p/3112905#M110080</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="523890" data-lia-user-login="3maris" class="lia-mention lia-mention-user"&gt;3maris&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;You can create a &lt;STRONG&gt;measure&lt;/STRONG&gt; as below to get it, please find the details in&lt;EM&gt;&lt;STRONG&gt; the attachment&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rank = 
VAR _selcountryIso =
    SELECTEDVALUE ( 'Table'[countryIso] )
VAR _rankv1 =
    RANKX (
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[countryIso] = _selcountryIso
                &amp;amp;&amp;amp; [metric 1] &amp;lt;&amp;gt; BLANK ()
        ),
        CALCULATE ( MAX ( 'Table'[date] ) ),,ASC
    )
VAR _rankv2 =
    RANKX (
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[countryIso] = _selcountryIso
                &amp;amp;&amp;amp; [metric 2] &amp;lt;&amp;gt; BLANK ()
        ),
        CALCULATE ( MAX ( 'Table'[date] ) ),,ASC
    )
VAR _rank1 =
    IF ( [metric 1] = BLANK (), BLANK (), _rankv1 )
VAR _rank2 =
    IF ( [metric 2] = BLANK (), BLANK (), _rankv2 )
VAR _rank =
    IF ( ISBLANK ( _rank1 ), _rank2, _rank1 )
RETURN
    IF ( ISINSCOPE ( 'Table'[date] ), _rank, BLANK () )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
    <pubDate>Mon, 06 Mar 2023 02:49:50 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-03-06T02:49:50Z</dc:date>
    <item>
      <title>Is RANKX the right answer to this problem?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-RANKX-the-right-answer-to-this-problem/m-p/3110402#M109840</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a dashboard where the user can select 2 different date ranges and compare the same metric.&lt;/P&gt;&lt;P&gt;Everything is working fine but now I would like to plot these data in a line chart for comparison.&lt;/P&gt;&lt;P&gt;The line chart would use the date as x-axis but with the current data, the lines will be plotted on different date making the comparison really hard.&lt;/P&gt;&lt;P&gt;I thought that using a RANKX function could help. The idea would be to create a rank based on the value of metric 1 or metric 2 and order the date ASC.&lt;BR /&gt;I would then use the ranking column as the x-axis.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I would like to archive&amp;nbsp;&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;If using RANKX is not the right thing to do, what would you suggest?&lt;BR /&gt;Any help would be great, I'm just starting to use PBI&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 13:45:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-RANKX-the-right-answer-to-this-problem/m-p/3110402#M109840</guid>
      <dc:creator>3maris</dc:creator>
      <dc:date>2023-03-03T13:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: Is RANKX the right answer to this problem?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-RANKX-the-right-answer-to-this-problem/m-p/3112905#M110080</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="523890" data-lia-user-login="3maris" class="lia-mention lia-mention-user"&gt;3maris&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;You can create a &lt;STRONG&gt;measure&lt;/STRONG&gt; as below to get it, please find the details in&lt;EM&gt;&lt;STRONG&gt; the attachment&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rank = 
VAR _selcountryIso =
    SELECTEDVALUE ( 'Table'[countryIso] )
VAR _rankv1 =
    RANKX (
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[countryIso] = _selcountryIso
                &amp;amp;&amp;amp; [metric 1] &amp;lt;&amp;gt; BLANK ()
        ),
        CALCULATE ( MAX ( 'Table'[date] ) ),,ASC
    )
VAR _rankv2 =
    RANKX (
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[countryIso] = _selcountryIso
                &amp;amp;&amp;amp; [metric 2] &amp;lt;&amp;gt; BLANK ()
        ),
        CALCULATE ( MAX ( 'Table'[date] ) ),,ASC
    )
VAR _rank1 =
    IF ( [metric 1] = BLANK (), BLANK (), _rankv1 )
VAR _rank2 =
    IF ( [metric 2] = BLANK (), BLANK (), _rankv2 )
VAR _rank =
    IF ( ISBLANK ( _rank1 ), _rank2, _rank1 )
RETURN
    IF ( ISINSCOPE ( 'Table'[date] ), _rank, BLANK () )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 02:49:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-RANKX-the-right-answer-to-this-problem/m-p/3112905#M110080</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-06T02:49:50Z</dc:date>
    </item>
    <item>
      <title>Re: Is RANKX the right answer to this problem?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-RANKX-the-right-answer-to-this-problem/m-p/3114668#M110231</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;first of all, thank you so much for your help.&lt;BR /&gt;I can see that your solution is working in your example file, so I've tried to apply it to my user scenario but it's not working 100%.&lt;BR /&gt;&lt;BR /&gt;Let me try to explain my case.&lt;BR /&gt;&lt;BR /&gt;I have 1 single table with with metric_1, and metric_2 by country and date.&lt;BR /&gt;On this table I have 2 date slider, that work on the same date dimension.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;Date range 1 slicer has an active relationship with the table while slicer 2 has an inactive relationship.&lt;BR /&gt;If you look at the Rank 1 measurement your code is working perfectly, it is considering only the dates with metric_1 &amp;gt; 0 and the rank is correct.&lt;BR /&gt;On Rank_2 things get interesting...&lt;BR /&gt;The formula of rank 2 is the same as rank 1, it just considers the metric_2.&amp;nbsp;&lt;BR /&gt;The ranking is correct only for the overlapping days but not for the remaining date_range_2 days that are not included in the date range 1 slicer.&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;It looks like that the ranking does not work properly for the date that are not included in the date range 1 slicer.&lt;BR /&gt;Here is an example of full overlap on date range slicer:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;And another example with no days overlapping&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 18:02:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-RANKX-the-right-answer-to-this-problem/m-p/3114668#M110231</guid>
      <dc:creator>3maris</dc:creator>
      <dc:date>2023-03-06T18:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: Is RANKX the right answer to this problem?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-RANKX-the-right-answer-to-this-problem/m-p/3115553#M110294</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="523890" data-lia-user-login="3maris" class="lia-mention lia-mention-user"&gt;3maris&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;In order to get a better understanding on your requirement and give you a suitable solution, could you&amp;nbsp;&lt;SPAN&gt;please provide some&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;raw data&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;in your table&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;exclude&amp;nbsp;sensitive&amp;nbsp;data&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;) with&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Text&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;&lt;SPAN&gt;format, visual settings(slicers&amp;amp;matrix)&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;and your&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;expected result&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;with backend logic and special examples?&amp;nbsp;It would be helpful to find out the solution. You can refer the following links to share the required info:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-provide-sample-data-in-the-Power-BI-Forum%2Fba-p%2F963216&amp;amp;data=05%7C01%7CClaire.Dong%40microsoft.com%7Cada9149bd91546a8432508dacd31ef9b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638047911607737134%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=EJlYfclgtrjgAEYj9Uo1AauqxaQm3hlQsjJMo4zCY1M%3D&amp;amp;reserved=0" target="_blank" rel="nofollow noopener noreferrer"&gt;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-Get-Your-Question-Answered-Quickly%2Fba-p%2F38490&amp;amp;data=05%7C01%7CClaire.Dong%40microsoft.com%7Cada9149bd91546a8432508dacd31ef9b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638047911607737134%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=7UEf71Mu2ySWC7MlgciaPViM1RqU5nx4OHGHG5EvNSw%3D&amp;amp;reserved=0" target="_blank" rel="nofollow noopener noreferrer"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;And&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;It is better&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;if you can share a&amp;nbsp;&lt;FONT color="#008000"&gt;&lt;STRONG&gt;simplified&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;pbix file. You can refer the following link to upload the file to the community. Thank you.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FDesktop%2FHow-to-upload-PBI-in-Community%2Fm-p%2F1672886&amp;amp;data=04%7C01%7Cv-yiruan%40microsoft.com%7C4f580813734d4a8355b008da16f6e91a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637847547341062885%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;amp;sdata=YJvujige2YITXKbKED9JieQm5LBdf%2F3IYPM4ggdiijQ%3D&amp;amp;reserved=0" target="_blank" rel="nofollow noopener noreferrer"&gt;How to upload PBI in Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 06:32:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-RANKX-the-right-answer-to-this-problem/m-p/3115553#M110294</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-07T06:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Is RANKX the right answer to this problem?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-RANKX-the-right-answer-to-this-problem/m-p/3115737#M110303</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;here is the pbix file&amp;nbsp;&lt;A href="https://www.dropbox.com/s/7s6v43dqlr358iy/Ranking_PBI.pbix?dl=0" target="_blank"&gt;https://www.dropbox.com/s/7s6v43dqlr358iy/Ranking_PBI.pbix?dl=0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I've also added an example of why I'm trying to get the rank.&lt;BR /&gt;I'm still not 100% sure this is the best option to get to it.&lt;BR /&gt;Thanks again for your time!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 08:14:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-RANKX-the-right-answer-to-this-problem/m-p/3115737#M110303</guid>
      <dc:creator>3maris</dc:creator>
      <dc:date>2023-03-07T08:14:16Z</dc:date>
    </item>
  </channel>
</rss>

