<?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: Rolling Total for Past 12 Months in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Total-for-Past-12-Months/m-p/2127242#M48795</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;LI-CODE lang="php"&gt;rolling total 12 =
VAR _Date =
    MAX ( 'Date'[Date] )
VAR _LDate =
    DATE ( YEAR ( _Date ) - 1, MONTH ( _Date ), DAY ( _Date ) )
RETURN
    CALCULATE (
        SUM ( financials[Sales] ),
        FILTER ( ALL ( 'Date' ), 'Date'[Date] &amp;lt;= _Date &amp;amp;&amp;amp; 'Date'[Date] &amp;gt; _LDate )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, please consider&amp;nbsp;&lt;STRONG&gt;accepting&lt;/STRONG&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp;it as the solution&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;to help the other members find it more quickly.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Appreciate your Kudos!!&lt;/STRONG&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Oct 2021 12:13:55 GMT</pubDate>
    <dc:creator>VahidDM</dc:creator>
    <dc:date>2021-10-11T12:13:55Z</dc:date>
    <item>
      <title>Rolling Total for Past 12 Months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Total-for-Past-12-Months/m-p/2126364#M48779</link>
      <description>&lt;P&gt;I have a date table and Financial table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I select a particular monthyear from slicer of date table then my visual should display rolling total of previous 12 months sales sum from that selected monthyear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eg if I select july 2014, then my visual should display&lt;STRONG&gt; Rolling sum&lt;/STRONG&gt; of sales from july 2013 to july 2014.&lt;STRONG&gt; i.e sales of February will be sum of Jan and feb, Sales of March should be sum of Jan,Feb and March and so on.&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My code -&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;rolling total = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var currentdate = MAX('Date'[Date])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var period = DATESINPERIOD('Date'[Date],currentdate,-12,MONTH)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE(SUM(financials[ Sales]),FILTER(ALL('Date'[Date]),'Date'[Date]&amp;lt;=currentdate),period)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;But I am getting wrong output:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I do that?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 08:25:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Total-for-Past-12-Months/m-p/2126364#M48779</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-11T08:25:07Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling Total for Past 12 Months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Total-for-Past-12-Months/m-p/2127242#M48795</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;LI-CODE lang="php"&gt;rolling total 12 =
VAR _Date =
    MAX ( 'Date'[Date] )
VAR _LDate =
    DATE ( YEAR ( _Date ) - 1, MONTH ( _Date ), DAY ( _Date ) )
RETURN
    CALCULATE (
        SUM ( financials[Sales] ),
        FILTER ( ALL ( 'Date' ), 'Date'[Date] &amp;lt;= _Date &amp;amp;&amp;amp; 'Date'[Date] &amp;gt; _LDate )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, please consider&amp;nbsp;&lt;STRONG&gt;accepting&lt;/STRONG&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp;it as the solution&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;to help the other members find it more quickly.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Appreciate your Kudos!!&lt;/STRONG&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 12:13:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Total-for-Past-12-Months/m-p/2127242#M48795</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2021-10-11T12:13:55Z</dc:date>
    </item>
  </channel>
</rss>

