<?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: dynamic time shifting in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/dynamic-time-shifting/m-p/1773064#M37143</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="214024" data-lia-user-login="globalwarme" class="lia-mention lia-mention-user"&gt;globalwarme&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't say your description is clear. Please give us a concrete example as close to the reality as possible. Best, explaining this with DAX and visuals.&lt;/P&gt;</description>
    <pubDate>Wed, 07 Apr 2021 21:53:01 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-04-07T21:53:01Z</dc:date>
    <item>
      <title>dynamic time shifting</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/dynamic-time-shifting/m-p/1772817#M37129</link>
      <description>&lt;P&gt;I am working with a group of public traded companies all with different year ends.&amp;nbsp; For example Apple's last year-end was September 30, 2020 while Target's was Jan 31, 2021.&amp;nbsp; I am trying to build a measure that will dynamically allow me to pull in a series of year ends for both companies.&amp;nbsp; The last year end I can handle with the LASTYEAR function, but I am having trouble dynamically pulling in dates for previous years.&amp;nbsp; PREVIOUSYEAR and DATEADD functions don't seem to work because they key off of my dateDim table, which can't tell between different year ends.&amp;nbsp; What I need to be able to do is move back one and two years from the LASTYEAR value, but can't seem to find a way to do this.&amp;nbsp; For example, my LASTYEAR value for Apple is September 30, 2020 and for Target is Jan 31, 2021 as expected.&amp;nbsp; But my previous year value for Apple is still September 20, 2020, which is not correct, while the previous year value for Target is correct.&amp;nbsp; Not sure how to handle this.&amp;nbsp; Any ideas how to handle this dynamically.&amp;nbsp; Many thanks&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 18:26:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/dynamic-time-shifting/m-p/1772817#M37129</guid>
      <dc:creator>globalwarme</dc:creator>
      <dc:date>2021-04-07T18:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic time shifting</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/dynamic-time-shifting/m-p/1773064#M37143</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="214024" data-lia-user-login="globalwarme" class="lia-mention lia-mention-user"&gt;globalwarme&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't say your description is clear. Please give us a concrete example as close to the reality as possible. Best, explaining this with DAX and visuals.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 21:53:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/dynamic-time-shifting/m-p/1773064#M37143</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-07T21:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic time shifting</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/dynamic-time-shifting/m-p/1773214#M37150</link>
      <description>&lt;P&gt;OK here is the Table (working in power pivot) with the date field representing the last reported fiscal year end for the companies.&amp;nbsp; Notice they are all different.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I am trying to create a dynamic reporting table that pulls in the right reporting dates for each company which will include last reported date and previous year, previous year + 1, previous year +2, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't just selct for the year, because as you will notice the last reported years don't match - for Walmart and Target the last reported year is 2021, but for Costco it is 2020.&amp;nbsp; This also complicates things when I try to use the PREVIOUSYEAR or DATEADD - 1 function.&amp;nbsp; The LASTDATE function produces the correct value for all of them, but when I try to shift back one year, it doesn't work (for Costco), because I have to key off of the DateDim table.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the DAX&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;lastDate = LASTDATE([incomeStatement[date])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then for the previous year I used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PY = CALCULATE([lastDate], DATEADD(dateDim[date], -1, YEAR))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this clarifies my problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;P&lt;/P&gt;</description>
      <pubDate>Thu, 08 Apr 2021 01:35:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/dynamic-time-shifting/m-p/1773214#M37150</guid>
      <dc:creator>globalwarme</dc:creator>
      <dc:date>2021-04-08T01:35:56Z</dc:date>
    </item>
  </channel>
</rss>

