<?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 REMAINING INVENTORY in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-REMAINING-INVENTORY/m-p/3064940#M106079</link>
    <description>&lt;P&gt;Here is a measure expression that seems to work. Replace T4 with your actual table name.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Remaining =
VAR maxdate =
    MAX ( T4[MONTH] )
VAR result =
    CALCULATE (
        SUMX ( t4, T4[STOCK] - T4[DEMAND] ),
        REMOVEFILTERS ( T4[MONTH] ),
        T4[MONTH] &amp;lt;= maxdate
    )
RETURN
    IF ( result &amp;gt; 0, result, 0 )&lt;/LI-CODE&gt;&lt;P&gt;Pat&lt;/P&gt;</description>
    <pubDate>Tue, 07 Feb 2023 00:12:56 GMT</pubDate>
    <dc:creator>ppm1</dc:creator>
    <dc:date>2023-02-07T00:12:56Z</dc:date>
    <item>
      <title>CALCULATE REMAINING INVENTORY</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-REMAINING-INVENTORY/m-p/3064195#M106035</link>
      <description>&lt;P&gt;Hello, i have a stock value by product at the begining of the month , and i also have a demand table where i have the forecast units&lt;BR /&gt;this two tables are related to a date table and a product table&lt;/P&gt;&lt;P&gt;what i need to do is to sustract the demand for the last stock value like in this example :&lt;/P&gt;&lt;P&gt;i need to calculate in dax the remaining stock Column&lt;/P&gt;&lt;P&gt;&lt;A title="this is the example file pbix" href="https://drive.google.com/drive/folders/1Pn0xT_N6BTDfqmRHdOFQcfa0_mJWPv8s?usp=sharing" target="_blank" rel="noopener"&gt;https://drive.google.com/drive/folders/1Pn0xT_N6BTDfqmRHdOFQcfa0_mJWPv8s?usp=sharing&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MONTH&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;STOCK&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DEMAND&amp;nbsp; &amp;nbsp; &amp;nbsp;REMAININING STOCK&lt;BR /&gt;01/01/2022&amp;nbsp; &amp;nbsp; &amp;nbsp; 1000&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;100&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;900&lt;BR /&gt;01/02/2022&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;200&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 700&lt;BR /&gt;01/03/2022&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;300&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 400&lt;BR /&gt;01/04/2022&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;100&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 300&lt;BR /&gt;01/05/2022&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;200&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 100&lt;BR /&gt;01/06/2022&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 100&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;01/07/2022&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 100&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;01/08/2022&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 200&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;01/09/2022&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 200&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;01/10/2022&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 200&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;01/11/2022&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 30&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;01/12/2022&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 100&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 15:51:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-REMAINING-INVENTORY/m-p/3064195#M106035</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-07T15:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE REMAINING INVENTORY</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-REMAINING-INVENTORY/m-p/3064940#M106079</link>
      <description>&lt;P&gt;Here is a measure expression that seems to work. Replace T4 with your actual table name.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Remaining =
VAR maxdate =
    MAX ( T4[MONTH] )
VAR result =
    CALCULATE (
        SUMX ( t4, T4[STOCK] - T4[DEMAND] ),
        REMOVEFILTERS ( T4[MONTH] ),
        T4[MONTH] &amp;lt;= maxdate
    )
RETURN
    IF ( result &amp;gt; 0, result, 0 )&lt;/LI-CODE&gt;&lt;P&gt;Pat&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 00:12:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-REMAINING-INVENTORY/m-p/3064940#M106079</guid>
      <dc:creator>ppm1</dc:creator>
      <dc:date>2023-02-07T00:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE REMAINING INVENTORY</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-REMAINING-INVENTORY/m-p/3066609#M106204</link>
      <description>&lt;P&gt;this works great , i thought i could figured out with that simple example , but i cant addapt it to mi example , i attach a pbix to show mi particular case , because the data its stored in different tables like&amp;nbsp;&lt;/P&gt;&lt;P&gt;stock : its the initial stock snapshot at the beginning of the month by country and product&lt;/P&gt;&lt;P&gt;demand :its the yearly demand by country , product and month&lt;/P&gt;&lt;P&gt;country: its the dim country&lt;/P&gt;&lt;P&gt;product :its the dim product&lt;/P&gt;&lt;P&gt;transit : its the future income of products , it should be add to the stock on a specific date&amp;nbsp;&lt;/P&gt;&lt;P&gt;calendar table : calendar dim&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 15:48:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-REMAINING-INVENTORY/m-p/3066609#M106204</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-07T15:48:04Z</dc:date>
    </item>
  </channel>
</rss>

