<?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: Previous Month of Selected Month not Working in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Month-of-Selected-Month-not-Working/m-p/4042946#M160346</link>
    <description>&lt;P&gt;Hello, if you have to use a stable filter and another&amp;nbsp; filter on changing&amp;nbsp; on the month, I think&amp;nbsp; you should use something&amp;nbsp; like that,&amp;nbsp; whith the intelligence function DateAdd :&amp;nbsp;&amp;nbsp;,DATEADD(DateTableWithCustomFiscalYear[Date],-1,Month))&lt;/P&gt;&lt;P&gt;You are shifting the month a month before, (you can use too whith Year,Quarter...)&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;</description>
    <pubDate>Mon, 15 Jul 2024 16:59:50 GMT</pubDate>
    <dc:creator>GuillaumePower</dc:creator>
    <dc:date>2024-07-15T16:59:50Z</dc:date>
    <item>
      <title>Previous Month of Selected Month not Working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Month-of-Selected-Month-not-Working/m-p/4042858#M160344</link>
      <description>&lt;P&gt;Hi, I am calculating some values with the following DAX Formula:&lt;/P&gt;&lt;PRE&gt;Trial_Actual =&lt;BR /&gt;VAR SelectedMonth =&lt;BR /&gt;    IF(&lt;BR /&gt;        HASONEVALUE('Calendar'[Month Number]),&lt;BR /&gt;            SELECTEDVALUE('Calendar'[Month Number]),&lt;BR /&gt;            [Latest Month]&lt;BR /&gt;    )&lt;BR /&gt;VAR var_volume = CALCULATE(SUMX(VW_WATERFALL, VW_WATERFALL[DATA]), VW_WATERFALL[CATEGORY] = "VOLUME")&lt;BR /&gt;RETURN&lt;BR /&gt;    SUMX(&lt;BR /&gt;        FILTER(&lt;BR /&gt;            VW_WATERFALL,&lt;BR /&gt;            VW_WATERFALL[MES] = SelectedMonth&lt;BR /&gt;        ),&lt;BR /&gt;    VW_WATERFALL[DATA]/var_volume&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;And it successfuly returns the correct values for the selected month:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;But I also need to calculate the values for the previous month and this is what mi current DAX looks like but for some reason it ain't working.&lt;/P&gt;&lt;PRE&gt;trial_previous =&lt;BR /&gt;    VAR P_Month = PREVIOUSMONTH('Calendar'[Date])&lt;BR /&gt;    VAR var_vol = CALCULATE(SUMX(VW_WATERFALL, VW_WATERFALL[DATA]), VW_WATERFALL[CATEGORY] = "VOLUME")&lt;BR /&gt;RETURN&lt;BR /&gt;    CALCULATE(&lt;BR /&gt;        SUMX(VW_WATERFALL,&lt;BR /&gt;            VW_WATERFALL[DATA])/var_vol,&lt;BR /&gt;            PREVIOUSMONTH('Calendar'[Date])&lt;BR /&gt;        )&lt;/PRE&gt;&lt;P&gt;This DAX is returning the values from the previous month BUT are being divided by the volume of current month. That's the problem I haven't figured out a way to fix. I've tried other alternatives of fx PREVIOUSMONTH() like "selected month - 1", but for some reason none have worked out. And in my&amp;nbsp;&lt;EM&gt;var_vol&lt;/EM&gt; variable, if I modify the filter in CALCULATE to &lt;EM&gt;"VW_WATERFALL[CATEGORY] = "VOLUME" &amp;amp;&amp;amp; P_Month"&lt;/EM&gt; I get an error that says "A table of multiple values was suppleid where a single value was expected".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So in a nutshell, for my previous-month values DAX formula, I need for my var_vol variable to be the volume from previous month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 15:40:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Month-of-Selected-Month-not-Working/m-p/4042858#M160344</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-15T15:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Month of Selected Month not Working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Month-of-Selected-Month-not-Working/m-p/4042946#M160346</link>
      <description>&lt;P&gt;Hello, if you have to use a stable filter and another&amp;nbsp; filter on changing&amp;nbsp; on the month, I think&amp;nbsp; you should use something&amp;nbsp; like that,&amp;nbsp; whith the intelligence function DateAdd :&amp;nbsp;&amp;nbsp;,DATEADD(DateTableWithCustomFiscalYear[Date],-1,Month))&lt;/P&gt;&lt;P&gt;You are shifting the month a month before, (you can use too whith Year,Quarter...)&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;</description>
      <pubDate>Mon, 15 Jul 2024 16:59:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Month-of-Selected-Month-not-Working/m-p/4042946#M160346</guid>
      <dc:creator>GuillaumePower</dc:creator>
      <dc:date>2024-07-15T16:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Month of Selected Month not Working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Month-of-Selected-Month-not-Working/m-p/4042974#M160349</link>
      <description>&lt;P&gt;Thank you so much Guillaume! Using DATEADD definitely simplified the approach. Just as I had to create one measure to sum values for "Actual" and one for "Previous", I also created 2 measures to sum the value of "Volume", one for actual and another ofr previous and divided each correspondant measure.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 17:30:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Month-of-Selected-Month-not-Working/m-p/4042974#M160349</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-15T17:30:05Z</dc:date>
    </item>
  </channel>
</rss>

