<?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: get value from the previous month in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/get-value-from-the-previous-month/m-p/3336558#M125140</link>
    <description>&lt;P&gt;Hello I tried this DAX and its very useful but may I ask how about if there's an order that needs to fill in like the image below. I need ($1535) to be in Mar 2022 since its the next month not in Apr 2022.&lt;BR /&gt;&amp;nbsp;&lt;img /&gt;&lt;BR /&gt;2nd column is the current month and 3rd column is the previous month.&lt;BR /&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Jul 2023 13:24:55 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-07-18T13:24:55Z</dc:date>
    <item>
      <title>get value from the previous month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/get-value-from-the-previous-month/m-p/2119190#M48564</link>
      <description>&lt;PRE&gt;&lt;SPAN class="Y2IQFc"&gt;hello, hope you all are well!&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class="Y2IQFc"&gt;I have a problem in a DAX measure.
I need to capture the previous result.
normally I would use DATEADD or PREVIOUSMONTH for this, but my problem is:
in my example, I don't have data for month 3, so in the analysis for month 4 I need to capture the last one before it with value
in this case month 2&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="Y2IQFc"&gt;here a small sample of the data:&lt;img /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="Y2IQFc"&gt;Can someone help me? Thank you very much!&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Oct 2021 13:27:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/get-value-from-the-previous-month/m-p/2119190#M48564</guid>
      <dc:creator>vvenditt</dc:creator>
      <dc:date>2021-10-06T13:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: get value from the previous month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/get-value-from-the-previous-month/m-p/2119202#M48565</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="330771" data-lia-user-login="vvenditt" class="lia-mention lia-mention-user"&gt;vvenditt&lt;/a&gt;&amp;nbsp;You may find this helpful - &lt;A href="https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008" target="_blank"&gt;https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 13:37:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/get-value-from-the-previous-month/m-p/2119202#M48565</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2021-10-06T13:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: get value from the previous month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/get-value-from-the-previous-month/m-p/2119497#M48571</link>
      <description>&lt;PRE&gt;&lt;SPAN class="Y2IQFc"&gt;Thank you very much for your help. the material will help me as a reference, but I still haven't been able to solve my problem.

the main point here is this:
if I'm evaluating the line of period 4, I want to compare it with period 3, but if there is no value in period 3, I want to compare it to period 2.

in my case I do not need to accumulate, but rather pay the amount prior to the period of the valuation context&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Oct 2021 15:35:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/get-value-from-the-previous-month/m-p/2119497#M48571</guid>
      <dc:creator>vvenditt</dc:creator>
      <dc:date>2021-10-06T15:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: get value from the previous month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/get-value-from-the-previous-month/m-p/2132255#M48930</link>
      <description>&lt;PRE&gt;&lt;SPAN class="Y2IQFc"&gt;hello I managed to solve it with this DAX code:

previous result =
var period_context = MAX (data [period])

var previous_period =
CALCULATE(
   MAX (data [period]),
   FILTER(
      ALL (data [period]),
      data [period] &amp;lt;period_context &amp;amp;&amp;amp;
      SUM (data [value]) &amp;lt;&amp;gt; BLANK ()
   )
)

var previous_month_value =
CALCULATE(
   SUM (data [value]),
   FILTER(
      ALL (data [period]),
      data [period] = previous_period
   )
)

Return
if(
   ISINSCOPE (data [period]),
   previous_month_value
)&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Oct 2021 11:36:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/get-value-from-the-previous-month/m-p/2132255#M48930</guid>
      <dc:creator>vvenditt</dc:creator>
      <dc:date>2021-10-13T11:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: get value from the previous month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/get-value-from-the-previous-month/m-p/2132257#M48931</link>
      <description>&lt;P&gt;tks&lt;/P&gt;</description>
      <pubDate>Wed, 13 Oct 2021 11:36:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/get-value-from-the-previous-month/m-p/2132257#M48931</guid>
      <dc:creator>vvenditt</dc:creator>
      <dc:date>2021-10-13T11:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: get value from the previous month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/get-value-from-the-previous-month/m-p/3336558#M125140</link>
      <description>&lt;P&gt;Hello I tried this DAX and its very useful but may I ask how about if there's an order that needs to fill in like the image below. I need ($1535) to be in Mar 2022 since its the next month not in Apr 2022.&lt;BR /&gt;&amp;nbsp;&lt;img /&gt;&lt;BR /&gt;2nd column is the current month and 3rd column is the previous month.&lt;BR /&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 13:24:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/get-value-from-the-previous-month/m-p/3336558#M125140</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-07-18T13:24:55Z</dc:date>
    </item>
  </channel>
</rss>

