<?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: Formula not working without adding the year on the visual in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-not-working-without-adding-the-year-on-the-visual/m-p/3546735#M136391</link>
    <description>&lt;P&gt;Its not wirking as you are using Selected value. So if there is no year column, the selected value is blank. Insted selected value, you may try max of date. Is also not showing the total as at total level your conditions doesnot matches.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Nov 2023 11:55:06 GMT</pubDate>
    <dc:creator>Rupak_bi</dc:creator>
    <dc:date>2023-11-22T11:55:06Z</dc:date>
    <item>
      <title>Formula not working without adding the year on the visual</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-not-working-without-adding-the-year-on-the-visual/m-p/3544451#M136278</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a formula (not time intelligence) to show the Calendar Week (CW) of the previous year (PY).&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However the formula doesnt work when I dont have the year in the table, please see below. Is there any tweak I can do to it so that it will still show regardless if the year field is there or not.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here the formula:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PY CW =&lt;/P&gt;&lt;P&gt;VAR _selectedYear = SELECTEDVALUE('Date'[Year])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR _selectedWeek = SELECTEDVALUE('Date'[Week])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; NOT ISINSCOPE('Date'[Week]),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUM(Orders[Sales]),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FILTER(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ALL('Date'),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Date'[Year] = _selectedYear -1&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; ),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUM(Orders[Sales]),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FILTER(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ALL('Date'),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Date'[Year] = _selectedYear -1 &amp;amp;&amp;amp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Date'[Week] = _selectedWeek&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also why in the table that is working the totals are not displayed?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much!!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 10:53:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-not-working-without-adding-the-year-on-the-visual/m-p/3544451#M136278</guid>
      <dc:creator>andicornejo12</dc:creator>
      <dc:date>2023-11-21T10:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Formula not working without adding the year on the visual</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-not-working-without-adding-the-year-on-the-visual/m-p/3546735#M136391</link>
      <description>&lt;P&gt;Its not wirking as you are using Selected value. So if there is no year column, the selected value is blank. Insted selected value, you may try max of date. Is also not showing the total as at total level your conditions doesnot matches.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 11:55:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-not-working-without-adding-the-year-on-the-visual/m-p/3546735#M136391</guid>
      <dc:creator>Rupak_bi</dc:creator>
      <dc:date>2023-11-22T11:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: Formula not working without adding the year on the visual</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-not-working-without-adding-the-year-on-the-visual/m-p/3548386#M136469</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="616151" data-lia-user-login="andicornejo12" class="lia-mention lia-mention-user"&gt;andicornejo12&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try the following formula.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;PY CW =
VAR _selectedYear =
    MAX ( 'Date'[Year] )
VAR _selectedWeek =
    MAX ( 'Date'[Week] )
RETURN
    IF (
        NOT ISINSCOPE ( 'Date'[Week] ),
        CALCULATE (
            SUM ( Orders[Sales] ),
            FILTER ( ALL ( 'Date' ), 'Date'[Year] = _selectedYear - 1 )
        ),
        CALCULATE (
            SUM ( Orders[Sales] ),
            FILTER (
                ALL ( 'Date' ),
                'Date'[Year] = _selectedYear - 1
                    &amp;amp;&amp;amp; 'Date'[Week] = _selectedWeek
            )
        )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;If this does not solve your problem, please provide more information about the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Charlotte&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;STRONG&gt;helps, then please consider&amp;nbsp;&lt;EM&gt;Accept it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Nov 2023 07:19:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-not-working-without-adding-the-year-on-the-visual/m-p/3548386#M136469</guid>
      <dc:creator>v-zhangti</dc:creator>
      <dc:date>2023-11-23T07:19:33Z</dc:date>
    </item>
  </channel>
</rss>

