<?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: Calculate Difference Between Month for Quantity with Filters in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-Between-Month-for-Quantity-with-Filters/m-p/3871656#M151245</link>
    <description>&lt;P&gt;can we share the data in a way we can copy it ?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Apr 2024 18:07:28 GMT</pubDate>
    <dc:creator>Alex87</dc:creator>
    <dc:date>2024-04-26T18:07:28Z</dc:date>
    <item>
      <title>Calculate Difference Between Month for Quantity with Filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-Between-Month-for-Quantity-with-Filters/m-p/3871499#M151237</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to calculate &lt;SPAN&gt;the month-over-month difference in quantity while FILTERING based on the same platformID and ShopID.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Example:&amp;nbsp;&lt;BR /&gt;row1 in table:&amp;nbsp;&lt;BR /&gt;P001-S001 - month 1 is 726&amp;nbsp;&lt;/P&gt;&lt;P&gt;P001-S001 - month 2 = month 2-month 1 = 769-726 = 43&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;Please help me. Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 16:21:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-Between-Month-for-Quantity-with-Filters/m-p/3871499#M151237</guid>
      <dc:creator>XuanNguyen</dc:creator>
      <dc:date>2024-04-26T16:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Difference Between Month for Quantity with Filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-Between-Month-for-Quantity-with-Filters/m-p/3871656#M151245</link>
      <description>&lt;P&gt;can we share the data in a way we can copy it ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 18:07:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-Between-Month-for-Quantity-with-Filters/m-p/3871656#M151245</guid>
      <dc:creator>Alex87</dc:creator>
      <dc:date>2024-04-26T18:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Difference Between Month for Quantity with Filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-Between-Month-for-Quantity-with-Filters/m-p/3872082#M151269</link>
      <description>&lt;P&gt;&lt;A href="https://docs.google.com/spreadsheets/d/1UuUASPU-JqQ5knkoDtUvdC3m-yYcZXHs/edit?usp=sharing&amp;amp;ouid=101993956754946887491&amp;amp;rtpof=true&amp;amp;sd=true" target="_blank" rel="noopener"&gt;https://docs.google.com/spreadsheets/d/1UuUASPU-JqQ5knkoDtUvdC3m-yYcZXHs/edit?usp=sharing&amp;amp;ouid=101993956754946887491&amp;amp;rtpof=true&amp;amp;sd=true&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Here you are.&lt;/P&gt;&lt;P&gt;(You can download it, and just need to use data with filter storage = 256gb)&lt;/P&gt;</description>
      <pubDate>Sat, 27 Apr 2024 07:11:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-Between-Month-for-Quantity-with-Filters/m-p/3872082#M151269</guid>
      <dc:creator>XuanNguyen</dc:creator>
      <dc:date>2024-04-27T07:11:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Difference Between Month for Quantity with Filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-Between-Month-for-Quantity-with-Filters/m-p/3872318#M151270</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="731582" data-lia-user-login="XuanNguyen" class="lia-mention lia-mention-user"&gt;XuanNguyen&lt;/a&gt;&amp;nbsp;Try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Diff w OFFSET = 
VAR CurrentQuantity = 
    'Table'[Quantity]
VAR PreviousQuantity = 
    OFFSET ( 
        -1,
        ALL ( 
            'Table'[ProductID], 
            'Table'[PlatformID], 
            'Table'[ShopID], 
            'Table'[CrawlMonth], 
            'Table'[Quantity] 
        ),
        ORDERBY ( 'Table'[CrawlMonth], ASC ),
        PARTITIONBY ( 'Table'[ProductID], 'Table'[PlatformID], 'Table'[ShopID] )    
    )
VAR PreviousQuantityValue = 
    SELECTCOLUMNS ( PreviousQuantity, 'Table'[Quantity] )
VAR Result = 
    CurrentQuantity - PreviousQuantityValue
RETURN 
    Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Apr 2024 13:43:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-Between-Month-for-Quantity-with-Filters/m-p/3872318#M151270</guid>
      <dc:creator>AntrikshSharma</dc:creator>
      <dc:date>2024-04-27T13:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Difference Between Month for Quantity with Filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-Between-Month-for-Quantity-with-Filters/m-p/3872340#M151271</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="731582" data-lia-user-login="XuanNguyen" class="lia-mention lia-mention-user"&gt;XuanNguyen&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In order to achieve your purpose, you need to create a calculated column with the following DAX (replace the name of the table MoM with your own table name)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR CurrentQuantity = 'MoM'[Quantity]
VAR PreviousMonthQuantity = 
    CALCULATE(
        MAX('MoM'[Quantity]),  
        FILTER(
            'MoM',
            'MoM'[ProductID] = EARLIER('MoM'[ProductID]) &amp;amp;&amp;amp;
            'MoM'[PlatformID] = EARLIER('MoM'[PlatformID]) &amp;amp;&amp;amp;
            'MoM'[ShopID] = EARLIER('MoM'[ShopID]) &amp;amp;&amp;amp;
            'MoM'[CrawlMonth] = EARLIER('MoM'[CrawlMonth]) - 1
        )
    )
RETURN
IF(
    ISBLANK(PreviousMonthQuantity),
    CurrentQuantity,
    CurrentQuantity - PreviousMonthQuantity
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Best regards,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;</description>
      <pubDate>Sat, 27 Apr 2024 14:22:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-Between-Month-for-Quantity-with-Filters/m-p/3872340#M151271</guid>
      <dc:creator>Alex87</dc:creator>
      <dc:date>2024-04-27T14:22:08Z</dc:date>
    </item>
  </channel>
</rss>

