<?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: Last non blank quarter in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-non-blank-quarter/m-p/3441170#M130717</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="599977" data-lia-user-login="Jenn3301" class="lia-mention lia-mention-user"&gt;Jenn3301&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You could apply the logic from the example below to solve your problem. However in your case the code is supposed to be more complicated - should you provide a mock dataset, I can try to adapt this logic for your measures.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;In plain text for convenience:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;NewValue = 
IF ( NOT ISBLANK ( [Value] ), 
     [Value],
     VAR CurrentPeriod = [Period]
     VAR LastValuePeriod = MAXX ( FILTER ( Data, NOT ISBLANK ( [Value] ) &amp;amp;&amp;amp; [Period] &amp;lt; CurrentPeriod ), [Period] )
     RETURN MINX ( FILTER ( Data, [Period] = LastValuePeriod ), [Value] )
)&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;Best Regards, &lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;Alexander&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;A href="https://youtube.com/@powerbi-vlog" target="_blank"&gt;My YouTube vlog in English&lt;/A&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;A href="https://youtube.com/@pbi-vlog" target="_blank"&gt;My YouTube vlog in Russian&lt;/A&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Sep 2023 08:37:18 GMT</pubDate>
    <dc:creator>barritown</dc:creator>
    <dc:date>2023-09-21T08:37:18Z</dc:date>
    <item>
      <title>Last non blank quarter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-non-blank-quarter/m-p/3439266#M130572</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Hi all!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Where it displays FALSE, I am trying to obtain the last non blank value from the "Previous Quarter - Average Invoice Unit Price".&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;I can do this this when the quarter is -1 but if there is more than 1 quarter with no value it doesnt work.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;img /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Average Invoice Unit Price = &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;CALCULATE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;AVERAGE('MaterialPurchasing'[Invc.price]),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;FILTER('MaterialPurchasing',&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;'MaterialPurchasing'[Invc.price]&amp;lt;&amp;gt;0))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Previous Quarter Average Invoice Unit Price = &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;CALCULATE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;[Average Invoice Unit Price], &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;DATEADD ('Date_Table'[Date], &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;-1, QUARTER))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Price Every Quarter = &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;VAR _Current = [Average Invoice Unit Price]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;VAR _Previous = [Previous Quarter Average Invoice Unit Price]&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;RETURN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;IF(_Current &amp;lt;&amp;gt; BLANK() &amp;amp;&amp;amp; _Previous = BLANK(), _Current,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;IF(_Current &amp;lt;&amp;gt; BLANK() &amp;amp;&amp;amp; _Previous &amp;lt;&amp;gt; BLANK(), _Current,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;IF(_Current = BLANK() &amp;amp;&amp;amp; _Previous &amp;lt;&amp;gt; BLANK(), _Previous,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;"FALSE")))&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 05:52:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-non-blank-quarter/m-p/3439266#M130572</guid>
      <dc:creator>Jenn3301</dc:creator>
      <dc:date>2023-09-20T05:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Last non blank quarter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-non-blank-quarter/m-p/3441170#M130717</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="599977" data-lia-user-login="Jenn3301" class="lia-mention lia-mention-user"&gt;Jenn3301&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You could apply the logic from the example below to solve your problem. However in your case the code is supposed to be more complicated - should you provide a mock dataset, I can try to adapt this logic for your measures.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;In plain text for convenience:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;NewValue = 
IF ( NOT ISBLANK ( [Value] ), 
     [Value],
     VAR CurrentPeriod = [Period]
     VAR LastValuePeriod = MAXX ( FILTER ( Data, NOT ISBLANK ( [Value] ) &amp;amp;&amp;amp; [Period] &amp;lt; CurrentPeriod ), [Period] )
     RETURN MINX ( FILTER ( Data, [Period] = LastValuePeriod ), [Value] )
)&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;Best Regards, &lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;Alexander&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;A href="https://youtube.com/@powerbi-vlog" target="_blank"&gt;My YouTube vlog in English&lt;/A&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;A href="https://youtube.com/@pbi-vlog" target="_blank"&gt;My YouTube vlog in Russian&lt;/A&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 08:37:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-non-blank-quarter/m-p/3441170#M130717</guid>
      <dc:creator>barritown</dc:creator>
      <dc:date>2023-09-21T08:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Last non blank quarter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-non-blank-quarter/m-p/3441682#M130762</link>
      <description>&lt;P&gt;You will need a column in your date dimension with sortable year &amp;amp; quarter values, like 20194,20201, 20202 etc.&lt;BR /&gt;But then this could work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Previous Quarter Average Invoice Unit Price = 
VAR curqtr = MIN('Date_Table'[YearQuarter])
VAR prevqtrs = CALCULATETABLE(VALUES('Date_Table'[YearQuarter]),ALL('Date'), 'Date_Table'[YearQuarter]&amp;lt;curqtr)
RETURN IF(NOT(ISBLANK([Average Invoice Unit Price])),LASTNONBLANKVALUE(prevqtrs,[Average Invoice Unit Price]))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 14:35:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-non-blank-quarter/m-p/3441682#M130762</guid>
      <dc:creator>sjoerdvn</dc:creator>
      <dc:date>2023-09-21T14:35:19Z</dc:date>
    </item>
  </channel>
</rss>

