<?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 How to reference previous record. Need help on DAX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-reference-previous-record-Need-help-on-DAX/m-p/3708483#M144269</link>
    <description>&lt;P&gt;Hi I am trying to get the % change between consecutive records.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Logic to determine the previous record is to sort the Pack Size in ascending order and then get the percentage change.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help me to determine the previous record.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403667" data-lia-user-login="123abc" class="lia-mention lia-mention-user"&gt;123abc&lt;/a&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="678168" data-lia-user-login="talespin" class="lia-mention lia-mention-user"&gt;talespin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Feb 2024 15:52:15 GMT</pubDate>
    <dc:creator>Pranali_R</dc:creator>
    <dc:date>2024-02-19T15:52:15Z</dc:date>
    <item>
      <title>How to reference previous record. Need help on DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-reference-previous-record-Need-help-on-DAX/m-p/3708483#M144269</link>
      <description>&lt;P&gt;Hi I am trying to get the % change between consecutive records.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Logic to determine the previous record is to sort the Pack Size in ascending order and then get the percentage change.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help me to determine the previous record.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403667" data-lia-user-login="123abc" class="lia-mention lia-mention-user"&gt;123abc&lt;/a&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="678168" data-lia-user-login="talespin" class="lia-mention lia-mention-user"&gt;talespin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 15:52:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-reference-previous-record-Need-help-on-DAX/m-p/3708483#M144269</guid>
      <dc:creator>Pranali_R</dc:creator>
      <dc:date>2024-02-19T15:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference previous record. Need help on DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-reference-previous-record-Need-help-on-DAX/m-p/3708694#M144285</link>
      <description>&lt;P&gt;HI,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="476762" data-lia-user-login="Pranali_R" class="lia-mention lia-mention-user"&gt;Pranali_R&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;try below column&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Column = 
var a = MAXX(FILTER('Table','Table'[package size]&amp;lt;EARLIER('Table'[package size])),'Table'[package size])
var b = CALCULATE(SUM('Table'[dollar]),FILTER('Table','Table'[package size]=a))
RETURN
IF(b=BLANK(),BLANK(),('Table'[dollar]-b)/b)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and convert it to percantage using format pane&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 06:05:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-reference-previous-record-Need-help-on-DAX/m-p/3708694#M144285</guid>
      <dc:creator>Dangar332</dc:creator>
      <dc:date>2024-02-20T06:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference previous record. Need help on DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-reference-previous-record-Need-help-on-DAX/m-p/3709842#M144342</link>
      <description>&lt;P&gt;To reference the previous record and calculate the percentage change between consecutive records in DAX (Data Analysis Expressions), you can use the following steps:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;First, ensure that your data is properly sorted in ascending order based on the Pack Size.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;You can use DAX functions like EARLIER() and LASTNONBLANK() to reference the previous record and calculate the percentage change.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Here's a sample DAX expression to calculate the percentage change:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Percentage Change =&lt;BR /&gt;VAR CurrentRecord = TableName[ColumnWithPackSize]&lt;BR /&gt;VAR PreviousRecord = CALCULATE(&lt;BR /&gt;LASTNONBLANK(TableName[ColumnWithPackSize], 1),&lt;BR /&gt;FILTER(ALL(TableName), TableName[ColumnWithPackSize] &amp;lt; CurrentRecord)&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;IF(&lt;BR /&gt;ISBLANK(PreviousRecord),&lt;BR /&gt;BLANK(),&lt;BR /&gt;(CurrentRecord - PreviousRecord) / PreviousRecord&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Replace TableName with the name of your table, and ColumnWithPackSize with the name of your column containing the pack sizes.&lt;/P&gt;&lt;P&gt;This expression calculates the percentage change between the current record and the previous record based on the sorted pack size. If there is no previous record (i.e., for the first record), it returns blank.&lt;/P&gt;&lt;P&gt;Make sure to adjust the column names and table names according to your data model. This formula should be added as a new calculated column or measure depending on where you want to use it in your Power BI report or DAX query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 05:37:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-reference-previous-record-Need-help-on-DAX/m-p/3709842#M144342</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2024-02-20T05:37:10Z</dc:date>
    </item>
  </channel>
</rss>

