<?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: Filter based on a related column with RANKX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-based-on-a-related-column-with-RANKX/m-p/1997976#M44331</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="196904" data-lia-user-login="Mohammad_Refaei" class="lia-mention lia-mention-user"&gt;Mohammad_Refaei&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This does not work as the columns in the second ALLSELECTED are from different tables&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;All column arguments of the ALL/ALLNOBLANKROW/ALLSELECTED/REMOVEFILTERS function must be from the same table.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Aug 2021 13:43:36 GMT</pubDate>
    <dc:creator>OBMBI</dc:creator>
    <dc:date>2021-08-04T13:43:36Z</dc:date>
    <item>
      <title>Filter based on a related column with RANKX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-based-on-a-related-column-with-RANKX/m-p/1997538#M44305</link>
      <description>&lt;P&gt;I am trying to calculate the TopN value for Confidence by Provider name for the latest date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The below works for the ProviderId but the Provider Name is available in a separate table. These are related with an active Cross directional filter, which is set to 'both'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I get this to work with the Provider Name? When I put the Provider Name in the legend on my trend chart, it does not recognise the relationship. I've also tried to add the USERELATIONSHIP into the RANKX function but also can't get this to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TopN Confidence by ProviderId = 
VAR SelectedTop = SELECTEDVALUE('TopN'[TopN])
VAR SelectedOrder = SELECTEDVALUE(FilterOrder[FilterOrder])
VAR RankOrder = IF(FilterOrder = "Top", 1, -1)

RETURN
SWITCH(TRUE(),
    SelectedOrder = "All", [Average Confidence],
    RANKX ( 
            FILTER(
                ALLSELECTED( 
                    'Confidence'[ProviderId], 'Confidence'[Date] 
                    ), 
                    'Confidence'[Date] = MAX(SortByDate[Date])
            ),
            'Confidence'[Average Confidence] * RankOrder
        )
                  &amp;lt;= SelectedTop,
        'Confidence'[Average Confidence]
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 10:28:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-based-on-a-related-column-with-RANKX/m-p/1997538#M44305</guid>
      <dc:creator>OBMBI</dc:creator>
      <dc:date>2021-08-04T10:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Filter based on a related column with RANKX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-based-on-a-related-column-with-RANKX/m-p/1997825#M44316</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="311084" data-lia-user-login="OBMBI" class="lia-mention lia-mention-user"&gt;OBMBI&lt;/a&gt; , if you create a rank on provider id and use it with provider name in visual, this means rank of provider id insider provider name &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to include provide name in Rank&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 12:32:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-based-on-a-related-column-with-RANKX/m-p/1997825#M44316</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-08-04T12:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: Filter based on a related column with RANKX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-based-on-a-related-column-with-RANKX/m-p/1997829#M44317</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Thanks for the reply, I am using the ProviderId in the RANKX and when I use the Provider Name in the visual, all ranks get set to 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, how would you include the Provider Name in the RANKX function? The ALLSELECTED only accepts fields from the same table, but they are in separate tables.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 12:35:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-based-on-a-related-column-with-RANKX/m-p/1997829#M44317</guid>
      <dc:creator>OBMBI</dc:creator>
      <dc:date>2021-08-04T12:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Filter based on a related column with RANKX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-based-on-a-related-column-with-RANKX/m-p/1997875#M44321</link>
      <description>&lt;P&gt;Please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TopN Confidence by ProviderId =
VAR SelectedTop =
    SELECTEDVALUE ( 'TopN'[TopN] )
VAR SelectedOrder =
    SELECTEDVALUE ( FilterOrder[FilterOrder] )
VAR RankOrder =
    IF ( FilterOrder = "Top", 1, -1 )
VAR RankingScope =
    IF ( ISINSCOPE ( ProvidersTable[ProviderName] ), "ProviderName", "ProviderID" )
RETURN
    SWITCH (
        TRUE (),
        SelectedOrder = "All", [Average Confidence],
        IF (
            RankingScope = "ProviderID",
            RANKX (
                FILTER (
                    ALLSELECTED ( 'Confidence'[ProviderId], 'Confidence'[Date] ),
                    'Confidence'[Date] = MAX ( SortByDate[Date] )
                ),
                'Confidence'[Average Confidence] * RankOrder
            ),
            RANKX (
                FILTER (
                    ALLSELECTED ( 'ProvidersTable'[ProviderName], 'Confidence'[Date] ),
                    'Confidence'[Date] = MAX ( SortByDate[Date] )
                ),
                'Confidence'[Average Confidence] * RankOrder
            )
        ) &amp;lt;= SelectedTop, 'Confidence'[Average Confidence]
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully it will work.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 12:53:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-based-on-a-related-column-with-RANKX/m-p/1997875#M44321</guid>
      <dc:creator>Mohammad_Refaei</dc:creator>
      <dc:date>2021-08-04T12:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: Filter based on a related column with RANKX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-based-on-a-related-column-with-RANKX/m-p/1997976#M44331</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="196904" data-lia-user-login="Mohammad_Refaei" class="lia-mention lia-mention-user"&gt;Mohammad_Refaei&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This does not work as the columns in the second ALLSELECTED are from different tables&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;All column arguments of the ALL/ALLNOBLANKROW/ALLSELECTED/REMOVEFILTERS function must be from the same table.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 13:43:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-based-on-a-related-column-with-RANKX/m-p/1997976#M44331</guid>
      <dc:creator>OBMBI</dc:creator>
      <dc:date>2021-08-04T13:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: Filter based on a related column with RANKX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-based-on-a-related-column-with-RANKX/m-p/1998040#M44338</link>
      <description>&lt;P&gt;You are right, I missed the fact that we are using 2 tables.&lt;/P&gt;&lt;P&gt;Why don't you add a calculated column with the related provider name and use it in the same context?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 14:18:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-based-on-a-related-column-with-RANKX/m-p/1998040#M44338</guid>
      <dc:creator>Mohammad_Refaei</dc:creator>
      <dc:date>2021-08-04T14:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Filter based on a related column with RANKX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-based-on-a-related-column-with-RANKX/m-p/2002224#M44451</link>
      <description>&lt;P&gt;Because this is my fact table.&lt;/P&gt;&lt;P&gt;1. The table is huge a calculated column would impact performance too much&lt;/P&gt;&lt;P&gt;2. The Provider isn't the only thing I need to rank, there are multiple columns in various dimTables, this is just 1 example.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Aug 2021 10:33:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-based-on-a-related-column-with-RANKX/m-p/2002224#M44451</guid>
      <dc:creator>OBMBI</dc:creator>
      <dc:date>2021-08-06T10:33:01Z</dc:date>
    </item>
  </channel>
</rss>

