<?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 Cumulative total for previous month using custom non-date slicer in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-total-for-previous-month-using-custom-non-date-slicer/m-p/2310176#M57397</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;Have been struggling with this for a long time now. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have &lt;STRONG&gt;current week, &lt;STRONG&gt;current month, &lt;STRONG&gt;previous week and &lt;STRONG&gt;previous month as a custom slicer in a disconnected table and one measure&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;to return results for each of the chosen periods. Everything works except for Previous month.&amp;nbsp;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;The part of the entire code which corresponds to Previous month below.&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;This link contains the sample file with all info needed,&amp;nbsp;&lt;A href="https://easyupload.io/gz15qz" target="_self"&gt;Sample file&amp;nbsp;&lt;/A&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SELECTEDVALUE ( 'Period slicer'[Period] ) = "Previous month",
VAR MaxDate =  
    EOMONTH ( MAX ( Period[Date] ), -1 ) //Returns the last day of previous month, 2021-12-31
VAR LastMonth =
    EOMONTH ( MaxDate, -1 ) + 1 //Returns the first day of previous month, making the period 2021-12-01 to 2021-12-31. The variables return the correct timeframe, but do not work in the visual.
RETURN
CALCULATE (
    [Number of loaded tonnes], 
        ALL ( Period[Date] ),
            Period[Date] &amp;lt;= MaxDate,
            Period[Date] &amp;gt;= LastMonth
          )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 31 Jan 2022 08:39:17 GMT</pubDate>
    <dc:creator>KrisD</dc:creator>
    <dc:date>2022-01-31T08:39:17Z</dc:date>
    <item>
      <title>Cumulative total for previous month using custom non-date slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-total-for-previous-month-using-custom-non-date-slicer/m-p/2310176#M57397</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;Have been struggling with this for a long time now. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have &lt;STRONG&gt;current week, &lt;STRONG&gt;current month, &lt;STRONG&gt;previous week and &lt;STRONG&gt;previous month as a custom slicer in a disconnected table and one measure&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;to return results for each of the chosen periods. Everything works except for Previous month.&amp;nbsp;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;The part of the entire code which corresponds to Previous month below.&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;This link contains the sample file with all info needed,&amp;nbsp;&lt;A href="https://easyupload.io/gz15qz" target="_self"&gt;Sample file&amp;nbsp;&lt;/A&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SELECTEDVALUE ( 'Period slicer'[Period] ) = "Previous month",
VAR MaxDate =  
    EOMONTH ( MAX ( Period[Date] ), -1 ) //Returns the last day of previous month, 2021-12-31
VAR LastMonth =
    EOMONTH ( MaxDate, -1 ) + 1 //Returns the first day of previous month, making the period 2021-12-01 to 2021-12-31. The variables return the correct timeframe, but do not work in the visual.
RETURN
CALCULATE (
    [Number of loaded tonnes], 
        ALL ( Period[Date] ),
            Period[Date] &amp;lt;= MaxDate,
            Period[Date] &amp;gt;= LastMonth
          )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 08:39:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-total-for-previous-month-using-custom-non-date-slicer/m-p/2310176#M57397</guid>
      <dc:creator>KrisD</dc:creator>
      <dc:date>2022-01-31T08:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative total for previous month using custom non-date slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-total-for-previous-month-using-custom-non-date-slicer/m-p/2310194#M57399</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="271854" data-lia-user-login="KrisD" class="lia-mention lia-mention-user"&gt;KrisD&lt;/a&gt; , You can use date table and time intelligence &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;refer example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))&lt;BR /&gt;last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))&lt;BR /&gt;last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))&lt;BR /&gt;next month Sales = CALCULATE(SUM(Sales[Sales Amount]),nextmonth('Date'[Date]))&lt;BR /&gt;this month = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH('Date'[Date])))&lt;BR /&gt;last MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))&lt;BR /&gt;previous month value = CALCULATE(sum('Table'[total hours value]),previousmonth('Date'[Date]))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Power BI — Year on Year with or Without Time Intelligence &lt;BR /&gt;&lt;A href="https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a" target="_blank"&gt;https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.youtube.com/watch?v=km41KfM_0uA" target="_blank"&gt;https://www.youtube.com/watch?v=km41KfM_0uA&lt;/A&gt;&lt;BR /&gt;Power BI — Qtr on Qtr with or Without Time Intelligence &lt;BR /&gt;&lt;A href="https://medium.com/@amitchandak.1978/power-bi-qtd-questions-time-intelligence-2-5-d842063da839" target="_blank"&gt;https://medium.com/@amitchandak.1978/power-bi-qtd-questions-time-intelligence-2-5-d842063da839&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.youtube.com/watch?v=8-TlVx7P0A0" target="_blank"&gt;https://www.youtube.com/watch?v=8-TlVx7P0A0&lt;/A&gt;&lt;BR /&gt;Power BI — Month on Month with or Without Time Intelligence &lt;BR /&gt;&lt;A href="https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e" target="_blank"&gt;https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.youtube.com/watch?v=6LUBbvcxtKA" target="_blank"&gt;https://www.youtube.com/watch?v=6LUBbvcxtKA&lt;/A&gt;&lt;BR /&gt;Power BI — Week on Week and WTD &lt;BR /&gt;&lt;A href="https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3" target="_blank"&gt;https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.youtube.com/watch?v=pnAesWxYgJ8" target="_blank"&gt;https://www.youtube.com/watch?v=pnAesWxYgJ8&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :&lt;A href="https://youtu.be/OBf0rjpp5Hw" target="_blank"&gt;https://youtu.be/OBf0rjpp5Hw&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 08:51:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-total-for-previous-month-using-custom-non-date-slicer/m-p/2310194#M57399</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-01-31T08:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative total for previous month using custom non-date slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-total-for-previous-month-using-custom-non-date-slicer/m-p/2310213#M57400</link>
      <description>&lt;P&gt;Hi, thanks for your quick reply!&amp;nbsp;&lt;/P&gt;&lt;P&gt;However I do not get the desired results from the code.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CALCULATE ( 
    [Number of loaded tonnes],
    DATESMTD (
        ENDOFMONTH ( 
            DATEADD ( Period[Date], -1, MONTH )
        )
    )
) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 08:59:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-total-for-previous-month-using-custom-non-date-slicer/m-p/2310213#M57400</guid>
      <dc:creator>KrisD</dc:creator>
      <dc:date>2022-01-31T08:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative total for previous month using custom non-date slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-total-for-previous-month-using-custom-non-date-slicer/m-p/2310225#M57403</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="271854" data-lia-user-login="KrisD" class="lia-mention lia-mention-user"&gt;KrisD&lt;/a&gt; , for previous month cumulative use only datesmtd with date add&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CALCULATE ( 
    [Number of loaded tonnes],
    DATESMTD (
         
            DATEADD ( Period[Date], -1, MONTH )
            )
) &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Endofmonth will give complete month on all dates&amp;nbsp; &lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 09:05:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-total-for-previous-month-using-custom-non-date-slicer/m-p/2310225#M57403</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-01-31T09:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative total for previous month using custom non-date slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-total-for-previous-month-using-custom-non-date-slicer/m-p/2310241#M57405</link>
      <description>&lt;P&gt;Thank you so much, looks like it works !!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will definitely save your code examples, have obviously been overthinking the way I calculate these kind of measures.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a side note, are you able to explain to me why my code with the EOMONTH variables do not work the way I thought they would?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 09:10:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-total-for-previous-month-using-custom-non-date-slicer/m-p/2310241#M57405</guid>
      <dc:creator>KrisD</dc:creator>
      <dc:date>2022-01-31T09:10:12Z</dc:date>
    </item>
  </channel>
</rss>

