<?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: DAX to compare two Revenue Year columns with RannkX function in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-compare-two-Revenue-Year-columns-with-RannkX-function/m-p/4677487#M179148</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;&amp;nbsp;No luck!&lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 02 May 2025 11:21:36 GMT</pubDate>
    <dc:creator>ribs</dc:creator>
    <dc:date>2025-05-02T11:21:36Z</dc:date>
    <item>
      <title>DAX to compare two Revenue Year columns with RannkX function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-compare-two-Revenue-Year-columns-with-RannkX-function/m-p/4677251#M179131</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to build a matrix with the customers column and two revenue columns for current year and previous year respectively and based on the user's input through a slicer on year. It should calculate Rank for that Year&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Rank = var CurrentYear = RANKX(ALLSELECTED(Customer[Name]); [Revenue Current];;DESC;Dense) var PreviousYear = RANKX(ALLSELECTED(Customer[Name]); [Revenue Previous];;DESC;Dense) RETURN if(SELECTEDVALUE(GLEntries[PostingDate].[Year])=2025;CurrentYear;PreviousYear)&lt;BR /&gt;&lt;BR /&gt;Below DAX is working but it shows results for only the selected year and for the other year blank is displayed.&lt;BR /&gt;How to solve this issue?&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Customer&lt;/TD&gt;&lt;TD&gt;Revenue Current&lt;/TD&gt;&lt;TD&gt;Revenue Previous&lt;/TD&gt;&lt;TD&gt;Rank (from 2024 to 2025 or from 2025 to 2024)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;60&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;E&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;70&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2025 09:44:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-compare-two-Revenue-Year-columns-with-RannkX-function/m-p/4677251#M179131</guid>
      <dc:creator>ribs</dc:creator>
      <dc:date>2025-05-02T09:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to compare two Revenue Year columns with RannkX function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-compare-two-Revenue-Year-columns-with-RannkX-function/m-p/4677275#M179133</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1232552" data-lia-user-login="ribs" class="lia-mention lia-mention-user"&gt;ribs&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a Measure for Revenue Current Year:&lt;/P&gt;
&lt;P&gt;DAX&lt;BR /&gt;Revenue Current = &lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM(GLEntries[Revenue]),&lt;BR /&gt;GLEntries[PostingDate].[Year] = SELECTEDVALUE(GLEntries[PostingDate].[Year])&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a Measure for Revenue Previous Year:&lt;/P&gt;
&lt;P&gt;DAX&lt;BR /&gt;Revenue Previous = &lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM(GLEntries[Revenue]),&lt;BR /&gt;GLEntries[PostingDate].[Year] = SELECTEDVALUE(GLEntries[PostingDate].[Year]) - 1&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Measure for Rank:&lt;/P&gt;
&lt;P&gt;DAX&lt;BR /&gt;Rank = &lt;BR /&gt;VAR CurrentYear = RANKX(&lt;BR /&gt;ALLSELECTED(Customer[Name]),&lt;BR /&gt;[Revenue Current],&lt;BR /&gt;,&lt;BR /&gt;DESC,&lt;BR /&gt;DENSE&lt;BR /&gt;)&lt;BR /&gt;VAR PreviousYear = RANKX(&lt;BR /&gt;ALLSELECTED(Customer[Name]),&lt;BR /&gt;[Revenue Previous],&lt;BR /&gt;,&lt;BR /&gt;DESC,&lt;BR /&gt;DENSE&lt;BR /&gt;)&lt;BR /&gt;RETURN &lt;BR /&gt;IF(&lt;BR /&gt;SELECTEDVALUE(GLEntries[PostingDate].[Year]) = 2025,&lt;BR /&gt;CurrentYear,&lt;BR /&gt;PreviousYear&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add Customer[Name] to the rows.&lt;BR /&gt;Add Revenue Current, Revenue Previous, and Rank measures to the values.&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2025 09:55:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-compare-two-Revenue-Year-columns-with-RannkX-function/m-p/4677275#M179133</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2025-05-02T09:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to compare two Revenue Year columns with RannkX function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-compare-two-Revenue-Year-columns-with-RannkX-function/m-p/4677424#M179143</link>
      <description>&lt;P&gt;Hallo,&lt;/P&gt;&lt;P&gt;Thanks for your response.&lt;BR /&gt;If you could see my message, I have written the exact same code. The issue still persists. If Year 2025 is selected that year revenue is displayed and the previous year is blank&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2025 11:02:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-compare-two-Revenue-Year-columns-with-RannkX-function/m-p/4677424#M179143</guid>
      <dc:creator>ribs</dc:creator>
      <dc:date>2025-05-02T11:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to compare two Revenue Year columns with RannkX function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-compare-two-Revenue-Year-columns-with-RannkX-function/m-p/4677444#M179146</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1232552" data-lia-user-login="ribs" class="lia-mention lia-mention-user"&gt;ribs&lt;/a&gt;&amp;nbsp;&amp;nbsp;Use MAX(GLEntries[PostingDate].[Year]) instead of SELECTEDVALUE(GLEntries[PostingDate].[Year])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Revenue Current Year Measure:&lt;/P&gt;
&lt;P&gt;DAX&lt;BR /&gt;Revenue Current =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM(GLEntries[Revenue]),&lt;BR /&gt;GLEntries[PostingDate].[Year] = MAX(GLEntries[PostingDate].[Year])&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Revenue Previous Year Measure:&lt;/P&gt;
&lt;P&gt;DAX&lt;BR /&gt;Revenue Previous =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM(GLEntries[Revenue]),&lt;BR /&gt;GLEntries[PostingDate].[Year] = MAX(GLEntries[PostingDate].[Year]) - 1&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rank Measure:&lt;/P&gt;
&lt;P&gt;DAX&lt;BR /&gt;Rank =&lt;BR /&gt;VAR CurrentYear = RANKX(&lt;BR /&gt;ALLSELECTED(Customer[Name]),&lt;BR /&gt;[Revenue Current],&lt;BR /&gt;,&lt;BR /&gt;DESC,&lt;BR /&gt;DENSE&lt;BR /&gt;)&lt;BR /&gt;VAR PreviousYear = RANKX(&lt;BR /&gt;ALLSELECTED(Customer[Name]),&lt;BR /&gt;[Revenue Previous],&lt;BR /&gt;,&lt;BR /&gt;DESC,&lt;BR /&gt;DENSE&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;IF(&lt;BR /&gt;SELECTEDVALUE(GLEntries[PostingDate].[Year]) = MAX(GLEntries[PostingDate].[Year]),&lt;BR /&gt;CurrentYear,&lt;BR /&gt;PreviousYear&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2025 11:09:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-compare-two-Revenue-Year-columns-with-RannkX-function/m-p/4677444#M179146</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2025-05-02T11:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to compare two Revenue Year columns with RannkX function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-compare-two-Revenue-Year-columns-with-RannkX-function/m-p/4677487#M179148</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;&amp;nbsp;No luck!&lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2025 11:21:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-compare-two-Revenue-Year-columns-with-RannkX-function/m-p/4677487#M179148</guid>
      <dc:creator>ribs</dc:creator>
      <dc:date>2025-05-02T11:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to compare two Revenue Year columns with RannkX function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-compare-two-Revenue-Year-columns-with-RannkX-function/m-p/4679767#M179248</link>
      <description>&lt;P&gt;Thankyou,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;, for your response.&lt;BR /&gt;&lt;BR /&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1232552" data-lia-user-login="ribs" class="lia-mention lia-mention-user"&gt;ribs&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;We appreciate your inquiry on the Microsoft Fabric Community Forum.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Please find attached the screenshot and PBIX file, which may help in resolving the issue:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If you find our response helpful, kindly mark it as the accepted solution and provide kudos. This will assist other community members who may have similar queries.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 05 May 2025 08:34:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-compare-two-Revenue-Year-columns-with-RannkX-function/m-p/4679767#M179248</guid>
      <dc:creator>v-pnaroju-msft</dc:creator>
      <dc:date>2025-05-05T08:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to compare two Revenue Year columns with RannkX function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-compare-two-Revenue-Year-columns-with-RannkX-function/m-p/4680381#M179270</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="814008" data-lia-user-login="v-pnaroju-msft" class="lia-mention lia-mention-user"&gt;v-pnaroju-msft&lt;/a&gt;&amp;nbsp;Thanks for your reply!&lt;BR /&gt;I would like to let you know that the issue was resolved. The problem was that I was using the year column that was connected to the sales table. I should use a disconnected column or a table for the slicer.&lt;BR /&gt;However, I checked your report. The output seems to be the same issue I was running into when I click on the Year slicer 2024, the Revenue Previous column is blank, but for 2025 it works fine&lt;/P&gt;</description>
      <pubDate>Mon, 05 May 2025 12:28:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-compare-two-Revenue-Year-columns-with-RannkX-function/m-p/4680381#M179270</guid>
      <dc:creator>ribs</dc:creator>
      <dc:date>2025-05-05T12:28:21Z</dc:date>
    </item>
  </channel>
</rss>

