<?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: help with getting total between two dates in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1115360#M16257</link>
    <description>No wonder it doesn't work... If you closely look at the definition of DATEADD (as you should do with all functions the functionality of which you don't fully know), you'll notice that it returns A TABLE, not a value. But DATESBETWEEN expects single values as the 2nd and 3rd argument.&lt;BR /&gt;&lt;BR /&gt;dax.guide/datesbetween/&lt;BR /&gt;dax.guide/dateadd/&lt;BR /&gt;&lt;BR /&gt;So, if you get the right dates and then stick them into DATESBETWEEN, you'll get a correct answer.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
    <pubDate>Sat, 23 May 2020 15:33:10 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-05-23T15:33:10Z</dc:date>
    <item>
      <title>help with getting total between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1108434#M16238</link>
      <description>&lt;P&gt;I am having issues getting the right dax measure to find the cummulative total between two dates in the past. the tricky part is i need to go back a 6mth period and then get the total of the previous 6 months.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So to explain in example, in my file, the max month is April 2020. I need to get the sum for Oct 2019 (6 mths ago) thru May 2019 (12 mths ago).&lt;/P&gt;&lt;P&gt;I am using a date table. I want to take selected month and get the sum for the previous 6-12 mths. I tried the following but its just not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;6-6 Gross Charges = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUM('ProjectX'[Gross Charges]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DATESBETWEEN(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Calendar'[Date],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DATEADD('Calendar'[Date],-6,MONTH),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DATEADD('Calendar'[Date],-11,MONTH)))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 23 May 2020 00:39:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1108434#M16238</guid>
      <dc:creator>cwnoll</dc:creator>
      <dc:date>2020-05-23T00:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: help with getting total between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1108455#M16240</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="142623" data-lia-user-login="cwnoll" class="lia-mention lia-mention-user"&gt;cwnoll&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may try the following link:&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;&lt;A href="https://www.vivran.in/post/moving-average-using-dax" target="_blank" rel="noopener"&gt;https://www.vivran.in/post/moving-average-using-dax&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;In this replace the average calculation with the sum.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;Cheers!&lt;BR /&gt;Vivek&lt;BR /&gt;&lt;BR /&gt;If it helps, please mark it as a solution&lt;BR /&gt;Kudos would be a cherry on the top &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.vivran.in/" target="_blank" rel="noopener"&gt;https://www.vivran.in/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/vivek-ranjan-063a1a17b/" target="_blank" rel="noopener"&gt;Connect on LinkedIn&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 23 May 2020 01:51:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1108455#M16240</guid>
      <dc:creator>vivran22</dc:creator>
      <dc:date>2020-05-23T01:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: help with getting total between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1108463#M16242</link>
      <description>&lt;P&gt;Please try this approach instead.&amp;nbsp; I've never actually tried this, but it just might work.&amp;nbsp; I thought it might unintentionally include the mindate in the date range, so I filtered that out.&amp;nbsp; Please let me know if it works.&amp;nbsp; If not, there is always the brute force approach using DATE(Year( ), Month(), Day(), but that is less elegant.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;6-6 Gross Charges =&lt;BR /&gt;VAR mindate =&lt;BR /&gt;MIN ( 'Calendar'[Date] )&lt;BR /&gt;VAR prev12mos =&lt;BR /&gt;DATESINPERIOD ( 'Calendar'[Date], mindate, -12, MONTH )&lt;BR /&gt;VAR prev6mos =&lt;BR /&gt;DATESINPERIOD ( 'Calendar'[Date], mindate, -6, MONTH )&lt;BR /&gt;VAR prevprev6mos =&lt;BR /&gt;FILTER ( EXCEPT ( prev12mos, prev6mos ), 'Calendar'[Date] &amp;lt;&amp;gt; mindate )&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE ( SUM ( 'ProjectX'[Gross Charges] ), prevprev6mos )&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;P&gt;If this works for you, please mark it as solution.&amp;nbsp; Kudos are appreciated too.&amp;nbsp; Please let me know if not.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pat&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 23 May 2020 02:04:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1108463#M16242</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-05-23T02:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: help with getting total between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1115360#M16257</link>
      <description>No wonder it doesn't work... If you closely look at the definition of DATEADD (as you should do with all functions the functionality of which you don't fully know), you'll notice that it returns A TABLE, not a value. But DATESBETWEEN expects single values as the 2nd and 3rd argument.&lt;BR /&gt;&lt;BR /&gt;dax.guide/datesbetween/&lt;BR /&gt;dax.guide/dateadd/&lt;BR /&gt;&lt;BR /&gt;So, if you get the right dates and then stick them into DATESBETWEEN, you'll get a correct answer.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
      <pubDate>Sat, 23 May 2020 15:33:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1115360#M16257</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-23T15:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: help with getting total between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1116051#M16263</link>
      <description>&lt;P&gt;Vivek,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried out this measure and had to make one a small correction (removed Filter() part and adding "-1" to each mindate).&amp;nbsp; Please see the updated measure below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;6-6 Gross Charges =&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR mindate =&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MIN ( 'Calendar'[Date] )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR prev12mos =&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;DATESINPERIOD ( 'Calendar'[Date], mindate-1, -12, MONTH )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR prev6mos =&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;DATESINPERIOD ( 'Calendar'[Date], mindate-1, -6, MONTH )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR prevprev6mos =&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;EXCEPT ( prev12mos, prev6mos )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CALCULATE ( SUM ( 'ProjectX'[Gross Charges] ), prevprev6mos )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Also, don't worry about trying to use functions and do things you don't fully understand.&amp;nbsp; Almost everyone in this community is sharing knowledge from all the mistakes they've made.&amp;nbsp; Keep learning and trying new things.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this works for you, please mark it as solution.&amp;nbsp; Kudos are appreciated too.&amp;nbsp; Please let me know if not.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pat&lt;/P&gt;</description>
      <pubDate>Sat, 23 May 2020 18:41:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1116051#M16263</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-05-23T18:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: help with getting total between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1116531#M16303</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="142623" data-lia-user-login="cwnoll" class="lia-mention lia-mention-user"&gt;cwnoll&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did any of the replies answers your query? If it does, then please mark it as a solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your problem is still unresolved, please share more details.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers!&lt;BR /&gt;Vivek&lt;BR /&gt;&lt;BR /&gt;If it helps, please mark it as a solution&lt;BR /&gt;Kudos would be a cherry on the top &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.vivran.in/" target="_blank"&gt;https://www.vivran.in/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/vivek-ranjan-063a1a17b/" target="_blank"&gt;Connect on LinkedIn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 14:05:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1116531#M16303</guid>
      <dc:creator>vivran22</dc:creator>
      <dc:date>2020-05-24T14:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: help with getting total between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1116625#M16330</link>
      <description>&lt;P&gt;Thank you so much for the quick feedback, but this still didnt work. Maybe I can attempt to explain better.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current month is April 2020, I need to find the SUM of the gross charges for May 2019 thru Oct 2019. The idea is April 2020 would skip previous 6 months, then get the sum of the previous 6 months to that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since current Month is April 2020, it would skip Mar2020,Feb2020,Jan2020,Dec2019,Nov2019,Sep2019, then sum Oct2019-May2019.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does this help at all?&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 17:39:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1116625#M16330</guid>
      <dc:creator>cwnoll</dc:creator>
      <dc:date>2020-05-24T17:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: help with getting total between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1116687#M16344</link>
      <description>&lt;P&gt;What result did you see with my latest expression?&amp;nbsp; I was pretty sure that would do it.&amp;nbsp; Are you using the Month column from your Calendar table in your visual?&amp;nbsp; Can you say more about your model?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this works for you, please mark it as solution.&amp;nbsp; Kudos are appreciated too.&amp;nbsp; Please let me know if not.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pat&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 20:22:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1116687#M16344</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-05-24T20:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: help with getting total between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1116822#M16350</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="142623" data-lia-user-login="cwnoll" class="lia-mention lia-mention-user"&gt;cwnoll&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Previous Six Month =
VAR _CurrentMonth =
    MAX ( dtCalendar[Date] )
VAR _StartMonth =
    EDATE ( [CurrentMonth], -12 ) + 1
VAR _Filter =
    DATESINPERIOD ( dtCalendar[Date], _StartMonth, 6, MONTH )
VAR _Sum =
    IF (
        _StartMonth &amp;gt;= FIRSTDATE ( ALLSELECTED ( dtCalendar[Date] ) ),
        CALCULATE ( SUMX ( dtCalendar, [Total Sales] ), _Filter )
    )
RETURN
    _Sum&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers!&lt;BR /&gt;Vivek&lt;BR /&gt;&lt;BR /&gt;If it helps, please mark it as a solution&lt;BR /&gt;Kudos would be a cherry on the top &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.vivran.in/" target="_blank"&gt;https://www.vivran.in/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/vivek-ranjan-063a1a17b/" target="_blank"&gt;Connect on LinkedIn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 May 2020 02:10:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/help-with-getting-total-between-two-dates/m-p/1116822#M16350</guid>
      <dc:creator>vivran22</dc:creator>
      <dc:date>2020-05-25T02:10:56Z</dc:date>
    </item>
  </channel>
</rss>

