<?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: retrieve latest non blank value if balnk value is selected in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/retrieve-latest-non-blank-value-if-balnk-value-is-selected/m-p/4008890#M157403</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="449986" data-lia-user-login="Sri57" class="lia-mention lia-mention-user"&gt;Sri57&lt;/a&gt;,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="81736" data-lia-user-login="aduguid" class="lia-mention lia-mention-user"&gt;aduguid&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;Thank you for your prompt reply!&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;To meet your requirements, it&lt;SPAN&gt;’&lt;/SPAN&gt;s necessary to use a name slicer to replace the name filter in table visual.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Then we need to add the Fiscal Year slicer from another table: Calendar to avoid blank value result.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lastly, create a new measure in Audit table and drag the measure in visual filter to control how visual display latest non blank value:&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;Measure = 
var _slicerYear=SELECTEDVALUE('Calendar'[Fiscal Year])
var _FilterCount=COUNTROWS(FILTER(ALLSELECTED('Audit'),[FISCAL_YEAR]=_slicerYear))
var _beforeYear=MAXX(FILTER(ALLSELECTED('Audit'),[FISCAL_YEAR]&amp;lt;=_slicerYear),[FISCAL_YEAR])
RETURN SWITCH(TRUE(),
ISFILTERED('Calendar'[Fiscal Year])=FALSE(),1,
_FilterCount=BLANK() &amp;amp;&amp;amp; MAX('Audit'[FISCAL_YEAR])=_beforeYear,1,
_FilterCount &amp;lt;&amp;gt; BLANK() &amp;amp;&amp;amp; MAX('Audit'[FISCAL_YEAR])= _slicerYear,1,0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Result for your reference:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Joyce&lt;/P&gt;&lt;P&gt;If this post&amp;nbsp;&lt;I&gt;&lt;STRONG&gt;helps, then please consider&amp;nbsp;Accept it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/I&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jun 2024 09:57:50 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-06-25T09:57:50Z</dc:date>
    <item>
      <title>retrieve latest non blank value if balnk value is selected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/retrieve-latest-non-blank-value-if-balnk-value-is-selected/m-p/4006212#M156818</link>
      <description>&lt;P&gt;I have a table Test with the columns Name, Rating, and Year. I'm using a Year slicer. If I select the value 2023/24 from the slicer, then I should get the count of records from that year. If there is no data for 2023/24, it should check for the previous year, 2022/23. If there is also no data for 2022/23, it should check for 2021/22, and so on, until it finds data, and get the count of records for the selection of 2023/24.&lt;BR /&gt;I tried to implement the logic, but I failed to get it exactly right. For example, when I select 2023/24 and there is no data for it, we get no records. Instead, the measure needs to retrieve the count of records for 2022/23.&lt;BR /&gt;I have attached the sameple pbix file&lt;BR /&gt;&lt;A href="https://www.dropbox.com/scl/fi/304a4rxdnmsb96ndgri5m/test1.pbix?rlkey=cv14d4zsqbsjp0m22y89h040o&amp;amp;st=ds96d08g&amp;amp;dl=0" target="_blank"&gt;https://www.dropbox.com/scl/fi/304a4rxdnmsb96ndgri5m/test1.pbix?rlkey=cv14d4zsqbsjp0m22y89h040o&amp;amp;st=ds96d08g&amp;amp;dl=0&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;TIA&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2024 07:20:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/retrieve-latest-non-blank-value-if-balnk-value-is-selected/m-p/4006212#M156818</guid>
      <dc:creator>Sri57</dc:creator>
      <dc:date>2024-06-24T07:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve latest non blank value if balnk value is selected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/retrieve-latest-non-blank-value-if-balnk-value-is-selected/m-p/4006879#M156863</link>
      <description>&lt;P&gt;Give this one a try.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Count Records = 
VAR SelectedYear = MAX('Calendar'[Year])
VAR CheckYear = 
    CALCULATE(
        MAX('Test'[Year]),
        FILTER(
            'Test',
            'Test'[Year] &amp;lt;= SelectedYear
        )
    )
VAR ResultCount = 
    CALCULATE(
        COUNTROWS('Test'),
        FILTER(
            'Test',
            'Test'[Year] = CheckYear
        )
    )
RETURN
    ResultCount&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2024 12:29:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/retrieve-latest-non-blank-value-if-balnk-value-is-selected/m-p/4006879#M156863</guid>
      <dc:creator>aduguid</dc:creator>
      <dc:date>2024-06-24T12:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve latest non blank value if balnk value is selected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/retrieve-latest-non-blank-value-if-balnk-value-is-selected/m-p/4008890#M157403</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="449986" data-lia-user-login="Sri57" class="lia-mention lia-mention-user"&gt;Sri57&lt;/a&gt;,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="81736" data-lia-user-login="aduguid" class="lia-mention lia-mention-user"&gt;aduguid&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;Thank you for your prompt reply!&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;To meet your requirements, it&lt;SPAN&gt;’&lt;/SPAN&gt;s necessary to use a name slicer to replace the name filter in table visual.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Then we need to add the Fiscal Year slicer from another table: Calendar to avoid blank value result.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lastly, create a new measure in Audit table and drag the measure in visual filter to control how visual display latest non blank value:&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;Measure = 
var _slicerYear=SELECTEDVALUE('Calendar'[Fiscal Year])
var _FilterCount=COUNTROWS(FILTER(ALLSELECTED('Audit'),[FISCAL_YEAR]=_slicerYear))
var _beforeYear=MAXX(FILTER(ALLSELECTED('Audit'),[FISCAL_YEAR]&amp;lt;=_slicerYear),[FISCAL_YEAR])
RETURN SWITCH(TRUE(),
ISFILTERED('Calendar'[Fiscal Year])=FALSE(),1,
_FilterCount=BLANK() &amp;amp;&amp;amp; MAX('Audit'[FISCAL_YEAR])=_beforeYear,1,
_FilterCount &amp;lt;&amp;gt; BLANK() &amp;amp;&amp;amp; MAX('Audit'[FISCAL_YEAR])= _slicerYear,1,0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Result for your reference:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Joyce&lt;/P&gt;&lt;P&gt;If this post&amp;nbsp;&lt;I&gt;&lt;STRONG&gt;helps, then please consider&amp;nbsp;Accept it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/I&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2024 09:57:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/retrieve-latest-non-blank-value-if-balnk-value-is-selected/m-p/4008890#M157403</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-25T09:57:50Z</dc:date>
    </item>
  </channel>
</rss>

