<?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 transactions while RANKX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-transactions-while-RANKX/m-p/1834350#M39035</link>
    <description>&lt;P&gt;You're not ranking transactions but products. And products have the types you mention, not transactions. It's not entirely clear what you're after since the description is misleading. Would you care to show what the correct output should look like, please? And please try to clarify your description.&lt;/P&gt;</description>
    <pubDate>Mon, 10 May 2021 18:54:08 GMT</pubDate>
    <dc:creator>daxer-almighty</dc:creator>
    <dc:date>2021-05-10T18:54:08Z</dc:date>
    <item>
      <title>Filter transactions while RANKX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-transactions-while-RANKX/m-p/1834309#M39034</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While ranking using RANKX, is it posible to filter the transaction based on some criteria ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a measure like this :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Rank = 
VAR tmpVal = SUM('Transactions'[Item qty])
RETURN
        IF(tmpVal = 0, BLANK(),
            RANKX(
                ALL('Products'[Item id]),
                CALCULATE(
                            SUM('Transactions'[Item qty]),
                            'Products'[Product type] = 1                            
                )
            )
        )&lt;/LI-CODE&gt;&lt;P&gt;The explanation to that, I put a filter inside the CALCULATE, for the transactions only for product with type = 1, which just some category inside my Product master.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the result I get now is :&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;If I remove the filter of product type then it is correct.&amp;nbsp;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Should I filter my Product as well ? it is seems odd, because if the transactions already filter, why they need to rank products which not in the transactions anyway.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 18:15:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-transactions-while-RANKX/m-p/1834309#M39034</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-05-10T18:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: Filter transactions while RANKX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-transactions-while-RANKX/m-p/1834350#M39035</link>
      <description>&lt;P&gt;You're not ranking transactions but products. And products have the types you mention, not transactions. It's not entirely clear what you're after since the description is misleading. Would you care to show what the correct output should look like, please? And please try to clarify your description.&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 18:54:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-transactions-while-RANKX/m-p/1834350#M39035</guid>
      <dc:creator>daxer-almighty</dc:creator>
      <dc:date>2021-05-10T18:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Filter transactions while RANKX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-transactions-while-RANKX/m-p/1834361#M39036</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="255913" data-lia-user-login="daxer-almighty" class="lia-mention lia-mention-user"&gt;daxer-almighty&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sorry, may I ask which one is not clear ? Maybe what a bit confusing is between "item id" and "product type code" ? item id is same like "product id", while "product type code" is another field inside my Product master, which use for a category, and right now I only want to rank products with type code =1 within my transactions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the correct / expected output, I think can refer to the image, I've sort the column "Item qty", so the rank should follow that order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I tried to change the measure, to filter the Product instead like this :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Rank = 
VAR tmpVal = SUM('Transactions'[Item qty])
RETURN
        IF(tmpVal = 0, BLANK(),
            RANKX(
                FILTER(
                        ALL('Products'),
                        'Products'[Product type code] = 1
                        ),
                CALCULATE(
                            SUM('Transactions'[Item qty])               
                ),,DESC,Dense
            )
        )&lt;/LI-CODE&gt;&lt;P&gt;It looks "correct" a bit, only there is one double rank like below:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 19:05:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-transactions-while-RANKX/m-p/1834361#M39036</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-05-10T19:05:24Z</dc:date>
    </item>
  </channel>
</rss>

