<?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 Orders by date and customer for product X in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-Orders-by-date-and-customer-for-product-X/m-p/3465629#M132249</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Assuming you have a table named &lt;/SPAN&gt;Orders&lt;SPAN&gt; with columns &lt;/SPAN&gt;OrderID&lt;SPAN&gt; and &lt;/SPAN&gt;OrderDate&lt;SPAN&gt;, you can add a calculated column to calculate the day of the year and then use it for sorting:&lt;BR /&gt;&lt;/SPAN&gt;&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;DayOfYear = YEAR(Orders[OrderDate]) * 1000 + DAYOFYEAR(Orders[OrderDate])&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;This expression combines the year and the day of the year to create a unique numeric value like 2023001 for January 1st, 2023, and so on&lt;BR /&gt;1. Now, you can sort the OrderID based on this calculated column. Go to the "Modeling" tab and select the Orders table.&lt;/P&gt;&lt;P&gt;2. In the "Sort by Column" option, choose the DayOfYear column&lt;BR /&gt;3.Finally, make sure to use the DayOfYear column as the sorting column in your visuals where you want to sort by this rank.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;OR&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;OrderSequence =
RANKX(
    FILTER(
        Orders,
        Orders[CustomerID] = EARLIER(Orders[CustomerID]) &amp;amp;&amp;amp;
        Orders[ProductID] = EARLIER(Orders[ProductID])
    ),
    Orders[OrderDate]
)&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 08 Oct 2023 12:19:51 GMT</pubDate>
    <dc:creator>_elbpower</dc:creator>
    <dc:date>2023-10-08T12:19:51Z</dc:date>
    <item>
      <title>Ranking Orders by date and customer for product X</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-Orders-by-date-and-customer-for-product-X/m-p/3465516#M132246</link>
      <description>&lt;P&gt;Hi masters,&lt;BR /&gt;I wish to a add a calculated column of ranking orders by date and customer for a specific Product. Demo data below:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;please assist with the correct DAX&lt;BR /&gt;&lt;BR /&gt;thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2023 08:07:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-Orders-by-date-and-customer-for-product-X/m-p/3465516#M132246</guid>
      <dc:creator>akfir</dc:creator>
      <dc:date>2023-10-08T08:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking Orders by date and customer for product X</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-Orders-by-date-and-customer-for-product-X/m-p/3465624#M132247</link>
      <description>&lt;P&gt;What if you just take the day of year?&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2023 12:11:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-Orders-by-date-and-customer-for-product-X/m-p/3465624#M132247</guid>
      <dc:creator>_elbpower</dc:creator>
      <dc:date>2023-10-08T12:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking Orders by date and customer for product X</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-Orders-by-date-and-customer-for-product-X/m-p/3465627#M132248</link>
      <description>&lt;P&gt;didnt understand your suggestion.&lt;BR /&gt;i need to figure out what is the customer X product 1st order, 2nd order, 3rd and so on... day of year has nothing to do with that.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2023 12:13:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-Orders-by-date-and-customer-for-product-X/m-p/3465627#M132248</guid>
      <dc:creator>akfir</dc:creator>
      <dc:date>2023-10-08T12:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking Orders by date and customer for product X</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-Orders-by-date-and-customer-for-product-X/m-p/3465629#M132249</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Assuming you have a table named &lt;/SPAN&gt;Orders&lt;SPAN&gt; with columns &lt;/SPAN&gt;OrderID&lt;SPAN&gt; and &lt;/SPAN&gt;OrderDate&lt;SPAN&gt;, you can add a calculated column to calculate the day of the year and then use it for sorting:&lt;BR /&gt;&lt;/SPAN&gt;&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;DayOfYear = YEAR(Orders[OrderDate]) * 1000 + DAYOFYEAR(Orders[OrderDate])&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;This expression combines the year and the day of the year to create a unique numeric value like 2023001 for January 1st, 2023, and so on&lt;BR /&gt;1. Now, you can sort the OrderID based on this calculated column. Go to the "Modeling" tab and select the Orders table.&lt;/P&gt;&lt;P&gt;2. In the "Sort by Column" option, choose the DayOfYear column&lt;BR /&gt;3.Finally, make sure to use the DayOfYear column as the sorting column in your visuals where you want to sort by this rank.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;OR&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;OrderSequence =
RANKX(
    FILTER(
        Orders,
        Orders[CustomerID] = EARLIER(Orders[CustomerID]) &amp;amp;&amp;amp;
        Orders[ProductID] = EARLIER(Orders[ProductID])
    ),
    Orders[OrderDate]
)&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2023 12:19:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-Orders-by-date-and-customer-for-product-X/m-p/3465629#M132249</guid>
      <dc:creator>_elbpower</dc:creator>
      <dc:date>2023-10-08T12:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking Orders by date and customer for product X</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-Orders-by-date-and-customer-for-product-X/m-p/3465796#M132253</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2023 18:48:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-Orders-by-date-and-customer-for-product-X/m-p/3465796#M132253</guid>
      <dc:creator>ThxAlot</dc:creator>
      <dc:date>2023-10-08T18:48:26Z</dc:date>
    </item>
  </channel>
</rss>

