<?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: SAMEPERIODLASTYEAR doesn't work with Interval time slicer in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SAMEPERIODLASTYEAR-doesn-t-work-with-Interval-time-slicer/m-p/1118013#M16394</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;units previous period =
CALCULATE (
    SUM ( 'Table1'[units] ),
    ALL ( 'Table1'[Datetime] ),
    SAMEPERIODLASTYEAR ( 'Table1'[Datetime].[Date] )
)&lt;/LI-CODE&gt;&lt;P&gt;This should work.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution!&lt;BR /&gt;Appreciate with a kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 25 May 2020 13:46:21 GMT</pubDate>
    <dc:creator>nandukrishnavs</dc:creator>
    <dc:date>2020-05-25T13:46:21Z</dc:date>
    <item>
      <title>SAMEPERIODLASTYEAR doesn't work with Interval time slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SAMEPERIODLASTYEAR-doesn-t-work-with-Interval-time-slicer/m-p/1117583#M16380</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the DAX function "SAMEPERIODLASTYEAR" to compare current units with the same period of the previous year and I want to use a "between" date interval filter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I include the previous year and this year it works perfectly for the current year data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;The problem is that if I select only the year 2020 in the slicer it doesn't return the data for the year 2019 in the "sameperiodlastyear" column:&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;Is there any way for this column to work using this kind of date range filter?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 25 May 2020 10:13:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SAMEPERIODLASTYEAR-doesn-t-work-with-Interval-time-slicer/m-p/1117583#M16380</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-25T10:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAMEPERIODLASTYEAR doesn't work with Interval time slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SAMEPERIODLASTYEAR-doesn-t-work-with-Interval-time-slicer/m-p/1117615#M16381</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because you are filtering the dates, so your last year rows will be removed from the context.&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use &lt;STRONG&gt;ALL()&lt;/STRONG&gt; or &lt;STRONG&gt;ALLEXCEPT()&lt;/STRONG&gt; functions to handle this situation. Example&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Desktop/SAMEPERIODLASTYEAR-with-filter/td-p/604118" target="_blank"&gt;https://community.powerbi.com/t5/Desktop/SAMEPERIODLASTYEAR-with-filter/td-p/604118&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Refer to this&amp;nbsp;&lt;A href="https://www.sqlbi.com/blog/marco/2010/04/05/all-allexcept-and-values-in-dax/" target="_blank" rel="noopener"&gt;https://www.sqlbi.com/blog/marco/2010/04/05/all-allexcept-and-values-in-dax/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or share your current logic and sample data&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution!&lt;BR /&gt;Appreciate with a kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 May 2020 10:46:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SAMEPERIODLASTYEAR-doesn-t-work-with-Interval-time-slicer/m-p/1117615#M16381</guid>
      <dc:creator>nandukrishnavs</dc:creator>
      <dc:date>2020-05-25T10:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: SAMEPERIODLASTYEAR doesn't work with Interval time slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SAMEPERIODLASTYEAR-doesn-t-work-with-Interval-time-slicer/m-p/1117987#M16391</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="32333" data-lia-user-login="nandukrishnavs" class="lia-mention lia-mention-user"&gt;nandukrishnavs&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My way to calculate the units in the previous period is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;units previous period = CALCULATE(SUM('table1'[units]);SAMEPERIODLASTYEAR('Table1'[Datetime].[Date]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have cheked your links but i still dont understand the way to do it. How i supose to use ALL or ALLEXCEPT in this function?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 25 May 2020 13:25:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SAMEPERIODLASTYEAR-doesn-t-work-with-Interval-time-slicer/m-p/1117987#M16391</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-25T13:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: SAMEPERIODLASTYEAR doesn't work with Interval time slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SAMEPERIODLASTYEAR-doesn-t-work-with-Interval-time-slicer/m-p/1118013#M16394</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;units previous period =
CALCULATE (
    SUM ( 'Table1'[units] ),
    ALL ( 'Table1'[Datetime] ),
    SAMEPERIODLASTYEAR ( 'Table1'[Datetime].[Date] )
)&lt;/LI-CODE&gt;&lt;P&gt;This should work.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution!&lt;BR /&gt;Appreciate with a kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 May 2020 13:46:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SAMEPERIODLASTYEAR-doesn-t-work-with-Interval-time-slicer/m-p/1118013#M16394</guid>
      <dc:creator>nandukrishnavs</dc:creator>
      <dc:date>2020-05-25T13:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: SAMEPERIODLASTYEAR doesn't work with Interval time slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SAMEPERIODLASTYEAR-doesn-t-work-with-Interval-time-slicer/m-p/1118541#M16444</link>
      <description>Please learn how to correctly use time-intel functions in DAX:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.sqlbi.com/tv/time-intelligence-in-microsoft-power-bi/" target="_blank"&gt;https://www.sqlbi.com/tv/time-intelligence-in-microsoft-power-bi/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Advice: DO NOT EVER USE THE AUTOMATICALLY CREATED DATE HIERARCHY. Create your own. You'll then be safe.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
      <pubDate>Tue, 26 May 2020 01:51:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SAMEPERIODLASTYEAR-doesn-t-work-with-Interval-time-slicer/m-p/1118541#M16444</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-26T01:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: SAMEPERIODLASTYEAR doesn't work with Interval time slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SAMEPERIODLASTYEAR-doesn-t-work-with-Interval-time-slicer/m-p/1120214#M16483</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your response&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="32333" data-lia-user-login="nandukrishnavs" class="lia-mention lia-mention-user"&gt;nandukrishnavs&lt;/a&gt;&amp;nbsp;and&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp; .&amp;nbsp;I have used your formula including the ALL and it does not work perfectly:&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Although the previous day's values are collected well when I filter for the last month of 2017, I need the previous year column (the last one in the capture) and the total to be filtered by the date filtered as well. However, with that formula neither the rows nor the total of the previous period are filtered.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to solve it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2020 12:22:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SAMEPERIODLASTYEAR-doesn-t-work-with-Interval-time-slicer/m-p/1120214#M16483</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-26T12:22:06Z</dc:date>
    </item>
  </channel>
</rss>

