<?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 Different Measures Displayed if Filter is selected or not in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-Measures-Displayed-if-Filter-is-selected-or-not/m-p/3611553#M139618</link>
    <description>&lt;P&gt;Hi and Happy New Year 2024 to the Community.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my issue:&amp;nbsp;I want to display a bar chart with 2023 values&lt;/P&gt;&lt;P&gt;1- if the "Year" filter does not have any selection, display chart using Measure #1 (only 2023 values)&lt;/P&gt;&lt;P&gt;2- if the "Year" filter has a selected valye, than use Measure #2 (values conditioned by filter selection)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jan 2024 00:43:43 GMT</pubDate>
    <dc:creator>JMSNYC</dc:creator>
    <dc:date>2024-01-03T00:43:43Z</dc:date>
    <item>
      <title>Different Measures Displayed if Filter is selected or not</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-Measures-Displayed-if-Filter-is-selected-or-not/m-p/3611553#M139618</link>
      <description>&lt;P&gt;Hi and Happy New Year 2024 to the Community.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my issue:&amp;nbsp;I want to display a bar chart with 2023 values&lt;/P&gt;&lt;P&gt;1- if the "Year" filter does not have any selection, display chart using Measure #1 (only 2023 values)&lt;/P&gt;&lt;P&gt;2- if the "Year" filter has a selected valye, than use Measure #2 (values conditioned by filter selection)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2024 00:43:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-Measures-Displayed-if-Filter-is-selected-or-not/m-p/3611553#M139618</guid>
      <dc:creator>JMSNYC</dc:creator>
      <dc:date>2024-01-03T00:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: Different Measures Displayed if Filter is selected or not</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-Measures-Displayed-if-Filter-is-selected-or-not/m-p/3629391#M140350</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="76704" data-lia-user-login="JMSNYC" class="lia-mention lia-mention-user"&gt;JMSNYC&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your description, I have created many measures to achieve the effect you are looking for. Following picture shows the effect of the display.&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;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Measures:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;AppearDataByYear =

VAR _slicer_count =

    DISTINCTCOUNT ( 'Slicer'[Year] ) 

VAR _all_count =

    COUNTROWS ( ALL ( 'Slicer' ) ) 

VAR _selcet_years =

    ALLSELECTED ( 'Slicer'[Year] ) 

VAR _max_year =

    CALCULATE ( MAX ( 'Table'[Year] ), ALL () ) 

VAR _filter =

    SWITCH (

        TRUE (),

        _slicer_count = _all_count, IF ( SELECTEDVALUE ( 'Table'[Year] ) = _max_year, 1 ),

        _slicer_count &amp;lt; _all_count, IF ( SELECTEDVALUE ( 'Table'[Year] ) IN _selcet_years, 1 ) 

    )

RETURN

    _filter&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this does not work, could you please share some sample data without sensitive information and expected output.&lt;BR /&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank" rel="noopener"&gt;How to provide sample data in the Power BI Forum - Microsoft Fabric Community&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener"&gt;How to get your questions answered quickly&lt;/A&gt;&amp;nbsp;--&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank" rel="noopener"&gt;&amp;nbsp;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 08:38:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-Measures-Displayed-if-Filter-is-selected-or-not/m-p/3629391#M140350</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-01T08:38:34Z</dc:date>
    </item>
  </channel>
</rss>

