<?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 Trouble with showing correct year value with slicers in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trouble-with-showing-correct-year-value-with-slicers/m-p/2041495#M45845</link>
    <description>&lt;P&gt;Hello everyone!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I'm so close with this code, but I keep running into the same issue and could use another set of eyes to point out what I'm missing.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What I'm trying to do is to simply display the values of year slicers on a card depending on 3 cases: no selection, current year, or current year -1. Here is my current code:&amp;nbsp;&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;var yearDefault = YEAR(NOW()) &amp;amp; " &amp;amp; " &amp;amp; YEAR(NOW())-1
var yearSelected = NOT( ISFILTERED( 'Data'[Year]))

VAR YearReturn =  IF( yearSelected
    , SELECTEDVALUE('Data'[Year]) 
    , yearDefault
    )


RETURN 
YearReturn&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is currently happening is when nothing is selected, I get a "(Blank)" showing in the card visual when it should be what I'm referencing in yearDefault, which is "2021 &amp;amp; 2020". Any ideas on what is causing this to show (Blank) instead of the years?&lt;BR /&gt;&lt;BR /&gt;I've tried many various attempts but it has never worked so far. I'd appreciate any help into this! So close!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Aug 2021 22:07:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-08-26T22:07:08Z</dc:date>
    <item>
      <title>Trouble with showing correct year value with slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trouble-with-showing-correct-year-value-with-slicers/m-p/2041495#M45845</link>
      <description>&lt;P&gt;Hello everyone!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I'm so close with this code, but I keep running into the same issue and could use another set of eyes to point out what I'm missing.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What I'm trying to do is to simply display the values of year slicers on a card depending on 3 cases: no selection, current year, or current year -1. Here is my current code:&amp;nbsp;&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;var yearDefault = YEAR(NOW()) &amp;amp; " &amp;amp; " &amp;amp; YEAR(NOW())-1
var yearSelected = NOT( ISFILTERED( 'Data'[Year]))

VAR YearReturn =  IF( yearSelected
    , SELECTEDVALUE('Data'[Year]) 
    , yearDefault
    )


RETURN 
YearReturn&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is currently happening is when nothing is selected, I get a "(Blank)" showing in the card visual when it should be what I'm referencing in yearDefault, which is "2021 &amp;amp; 2020". Any ideas on what is causing this to show (Blank) instead of the years?&lt;BR /&gt;&lt;BR /&gt;I've tried many various attempts but it has never worked so far. I'd appreciate any help into this! So close!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 22:07:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trouble-with-showing-correct-year-value-with-slicers/m-p/2041495#M45845</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-26T22:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with showing correct year value with slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trouble-with-showing-correct-year-value-with-slicers/m-p/2041780#M45854</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this measure:&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;Selected Year = 
Var _yearDefault = YEAR(today()) &amp;amp; " &amp;amp; " &amp;amp; YEAR(today())-1
VAR _YearReturn =  IF( HASONEVALUE('Data'[Year])
    , SELECTEDVALUE('Data'[Year]) 
    , _yearDefault
    )


RETURN 
_YearReturn&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution!&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Appreciate your Kudos&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;img /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;STRONG&gt;!!&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 02:55:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trouble-with-showing-correct-year-value-with-slicers/m-p/2041780#M45854</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2021-08-27T02:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with showing correct year value with slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trouble-with-showing-correct-year-value-with-slicers/m-p/2043102#M45886</link>
      <description>&lt;P&gt;I was thinking of how to fix this and discovered an easier way if I just removed the IF statement.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var yearDefault = YEAR(NOW()) &amp;amp; " &amp;amp; " &amp;amp; YEAR(NOW())-1

VAR test = SELECTEDVALUE('data'[Year], yearDefault)&lt;/LI-CODE&gt;&lt;P&gt;As I normally do, I was overcomplicating it.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 14:59:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trouble-with-showing-correct-year-value-with-slicers/m-p/2043102#M45886</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-27T14:59:00Z</dc:date>
    </item>
  </channel>
</rss>

