<?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 Previous Year DAX Calculation in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-DAX-Calculation/m-p/2948604#M97645</link>
    <description>&lt;P&gt;Hi Team&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please can you help me on below issue. I have created a table like below in power bi.&lt;/P&gt;&lt;P&gt;By default current month selection is applied and calculated CY and PY measures like below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CY= CALCULATE( Sum(SalesNetAmountGBP]),Date'[CurrentDayOffset]&amp;lt;=0)&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;PY = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[CY]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;SAMEPERIODLASTYEAR&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Date'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;STRONG&gt;Issue&lt;/STRONG&gt;: When i have selected 2022 full year PY measure is showing data upto 2021 december 31st instead of 2021 december 5th (today). Please can you help to write DAX for&amp;nbsp; PY measure to show last year today date data dynamically .&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&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;Thanks in advance&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="259995" data-lia-user-login="v-janeyg-msft" class="lia-mention lia-mention-user"&gt;v-janeyg-msft&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Dec 2022 13:55:21 GMT</pubDate>
    <dc:creator>Pawan</dc:creator>
    <dc:date>2022-12-05T13:55:21Z</dc:date>
    <item>
      <title>Previous Year DAX Calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-DAX-Calculation/m-p/2948604#M97645</link>
      <description>&lt;P&gt;Hi Team&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please can you help me on below issue. I have created a table like below in power bi.&lt;/P&gt;&lt;P&gt;By default current month selection is applied and calculated CY and PY measures like below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CY= CALCULATE( Sum(SalesNetAmountGBP]),Date'[CurrentDayOffset]&amp;lt;=0)&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;PY = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[CY]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;SAMEPERIODLASTYEAR&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Date'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;STRONG&gt;Issue&lt;/STRONG&gt;: When i have selected 2022 full year PY measure is showing data upto 2021 december 31st instead of 2021 december 5th (today). Please can you help to write DAX for&amp;nbsp; PY measure to show last year today date data dynamically .&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&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;Thanks in advance&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="259995" data-lia-user-login="v-janeyg-msft" class="lia-mention lia-mention-user"&gt;v-janeyg-msft&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 13:55:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-DAX-Calculation/m-p/2948604#M97645</guid>
      <dc:creator>Pawan</dc:creator>
      <dc:date>2022-12-05T13:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Year DAX Calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-DAX-Calculation/m-p/2948816#M97661</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="293337" data-lia-user-login="Pawan" class="lia-mention lia-mention-user"&gt;Pawan&lt;/a&gt; , &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PY = CALCULATE([CY], SAMEPERIODLASTYEAR('Date'[Date]), format([Date],"MMDD") &amp;lt;= format(today() ,"MMDD")&amp;nbsp; )&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 15:19:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-DAX-Calculation/m-p/2948816#M97661</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-12-05T15:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Year DAX Calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-DAX-Calculation/m-p/2948880#M97671</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;thank you for your reply. The above solution works only for complete year(2022) selection. But is breaking when we select month or quarter. The measure should be dynamic based on Date selection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 15:54:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-DAX-Calculation/m-p/2948880#M97671</guid>
      <dc:creator>Pawan</dc:creator>
      <dc:date>2022-12-05T15:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Year DAX Calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-DAX-Calculation/m-p/2948990#M97676</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="293337" data-lia-user-login="Pawan" class="lia-mention lia-mention-user"&gt;Pawan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please try&lt;/P&gt;
&lt;P&gt;PY =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;[CY],&lt;BR /&gt;FILTER (&lt;BR /&gt;SAMEPERIODLASTYEAR ( 'Date'[Date] ),&lt;BR /&gt;FORMAT ( [Date], "MMDD" ) &amp;lt;= FORMAT ( TODAY (), "MMDD" )&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 16:35:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-DAX-Calculation/m-p/2948990#M97676</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-12-05T16:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Year DAX Calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-DAX-Calculation/m-p/2951335#M97852</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tha above solution is working for both month and year selection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Pawan&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 11:59:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-DAX-Calculation/m-p/2951335#M97852</guid>
      <dc:creator>Pawan</dc:creator>
      <dc:date>2022-12-06T11:59:24Z</dc:date>
    </item>
  </channel>
</rss>

