<?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: FIRSTNONBLANK to get the previous row value is not working as expected in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FIRSTNONBLANK-to-get-the-previous-row-value-is-not-working-as/m-p/2578949#M73939</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="299999" data-lia-user-login="justlogmein" class="lia-mention lia-mention-user"&gt;justlogmein&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How about this?&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Oil Changed for Previous Row 2 =
VAR PreDate_ =
    CALCULATE (
        MAX ( 'Sample Data'[Sample Date] ),
        FILTER (
            'Sample Data',
            'Sample Data'[Sample Date] &amp;lt; EARLIER ( 'Sample Data'[Sample Date] )
                &amp;amp;&amp;amp; 'Sample Data'[Unit Number] = EARLIER ( 'Sample Data'[Unit Number] )
        )
    )
VAR PreOilChanged_ =
    CALCULATE (
        FIRSTNONBLANK ( 'Sample Data'[Oil Changed], 1 ),
        FILTER (
            'Sample Data',
            'Sample Data'[Sample Date] = PreDate_
                &amp;amp;&amp;amp; 'Sample Data'[Unit Number] = EARLIER ( 'Sample Data'[Unit Number] )
        )
    )
RETURN
    PreOilChanged_
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Icey&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jun 2022 02:44:10 GMT</pubDate>
    <dc:creator>Icey</dc:creator>
    <dc:date>2022-06-15T02:44:10Z</dc:date>
    <item>
      <title>FIRSTNONBLANK to get the previous row value is not working as expected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FIRSTNONBLANK-to-get-the-previous-row-value-is-not-working-as/m-p/2573108#M73582</link>
      <description>&lt;P&gt;I am trying to get the TRUE/FALSE value of the previous row. I have read to be able to do this for a row that isn't a number I need to use FIRSTNONBLANK with a 1 as the expression. However, for some reason this works for a bit then just wants to stick to a single value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used the following DAX to get to this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;=
CALCULATE
	(
	FIRSTNONBLANK
		(
		'Sample Data'[Oil Changed],1
		),
	FILTER
		(
		'Sample Data',
		'Sample Data'[Sample Date] &amp;lt; EARLIER
			(
			'Sample Data'[Sample Date]
			)
		&amp;amp;&amp;amp; 'Sample Data'[Unit Number] = EARLIER
			(
			'Sample Data'[Unit Number]
			)
		)
	)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the output, plus what I actually want in the end column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know how I can do this? Power BI example file below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://jmservicescomau-my.sharepoint.com/:u:/g/personal/jacob_jmservices_com_au/EZDoydiTFEtPtM0RXhpjDKkBCv6eMKWCxFqcVZGC40w-Vg?e=O6dK5z" target="_self"&gt;Get Previous Value&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just as a side rant, there really needs to be a better way of doing something simple like this. In Excel, it is literally "=[cell you want to reference]" in a table and it's done for the whole column. In DAX this is several lines of code...&lt;/P&gt;</description>
      <pubDate>Sun, 12 Jun 2022 07:32:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FIRSTNONBLANK-to-get-the-previous-row-value-is-not-working-as/m-p/2573108#M73582</guid>
      <dc:creator>justlogmein</dc:creator>
      <dc:date>2022-06-12T07:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: FIRSTNONBLANK to get the previous row value is not working as expected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FIRSTNONBLANK-to-get-the-previous-row-value-is-not-working-as/m-p/2573139#M73583</link>
      <description>&lt;P&gt;Excel is a spreadsheet and has a named cell reference. This means every datapoint has its own address. This is very useful, but comes at a cost. Try adding a million rows of data and writing a formula in each row. &amp;nbsp;Power BI is not a spreadsheet, it is a column store reporting database. It is optimised for fast and efficient aggregations, calculations and data storage. But that comes at a cost. There is no cell reference and no referential "order" in the data itself, hence this particular problem is difficult to solve in PBI.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Depending on the problem, you may be better off loading the value from the "previous row" using Power Query and loading it into the final loaded table in PBI. I show how to do this in my video here.&amp;nbsp;&lt;BR /&gt;&lt;A href="https://youtu.be/xN2IRXQ2CvI" target="_blank" rel="noopener"&gt;https://youtu.be/xN2IRXQ2CvI&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;This may add preprocessing time, but it's often a better way to solve the problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Jun 2022 09:06:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FIRSTNONBLANK-to-get-the-previous-row-value-is-not-working-as/m-p/2573139#M73583</guid>
      <dc:creator>MattAllington</dc:creator>
      <dc:date>2022-06-12T09:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: FIRSTNONBLANK to get the previous row value is not working as expected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FIRSTNONBLANK-to-get-the-previous-row-value-is-not-working-as/m-p/2573147#M73584</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Jun 2022 09:28:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FIRSTNONBLANK-to-get-the-previous-row-value-is-not-working-as/m-p/2573147#M73584</guid>
      <dc:creator>CNENFRNL</dc:creator>
      <dc:date>2022-06-12T09:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: FIRSTNONBLANK to get the previous row value is not working as expected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FIRSTNONBLANK-to-get-the-previous-row-value-is-not-working-as/m-p/2573179#M73586</link>
      <description>&lt;P&gt;Thank you for this, however when I try I am not getting the expected results. I am getting 1's and 0's and the pattern doesn't seem to line up with the Oil Changed column. Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Jun 2022 10:50:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FIRSTNONBLANK-to-get-the-previous-row-value-is-not-working-as/m-p/2573179#M73586</guid>
      <dc:creator>justlogmein</dc:creator>
      <dc:date>2022-06-12T10:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: FIRSTNONBLANK to get the previous row value is not working as expected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FIRSTNONBLANK-to-get-the-previous-row-value-is-not-working-as/m-p/2578949#M73939</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="299999" data-lia-user-login="justlogmein" class="lia-mention lia-mention-user"&gt;justlogmein&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How about this?&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Oil Changed for Previous Row 2 =
VAR PreDate_ =
    CALCULATE (
        MAX ( 'Sample Data'[Sample Date] ),
        FILTER (
            'Sample Data',
            'Sample Data'[Sample Date] &amp;lt; EARLIER ( 'Sample Data'[Sample Date] )
                &amp;amp;&amp;amp; 'Sample Data'[Unit Number] = EARLIER ( 'Sample Data'[Unit Number] )
        )
    )
VAR PreOilChanged_ =
    CALCULATE (
        FIRSTNONBLANK ( 'Sample Data'[Oil Changed], 1 ),
        FILTER (
            'Sample Data',
            'Sample Data'[Sample Date] = PreDate_
                &amp;amp;&amp;amp; 'Sample Data'[Unit Number] = EARLIER ( 'Sample Data'[Unit Number] )
        )
    )
RETURN
    PreOilChanged_
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Icey&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 02:44:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FIRSTNONBLANK-to-get-the-previous-row-value-is-not-working-as/m-p/2578949#M73939</guid>
      <dc:creator>Icey</dc:creator>
      <dc:date>2022-06-15T02:44:10Z</dc:date>
    </item>
  </channel>
</rss>

