<?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 Dax in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax/m-p/3023179#M102954</link>
    <description>&lt;P&gt;I have a table which has purchase and sales for each item. I need a Dax formula which looks at an item and the earliest date which has "Purchase" (so this is the starting point) and then any add sales to deduct from total and if purchase add that on. This will allow me to identify out of stock days.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help?&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, 16 Jan 2023 12:31:54 GMT</pubDate>
    <dc:creator>RickF83</dc:creator>
    <dc:date>2023-01-16T12:31:54Z</dc:date>
    <item>
      <title>Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax/m-p/3023179#M102954</link>
      <description>&lt;P&gt;I have a table which has purchase and sales for each item. I need a Dax formula which looks at an item and the earliest date which has "Purchase" (so this is the starting point) and then any add sales to deduct from total and if purchase add that on. This will allow me to identify out of stock days.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help?&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, 16 Jan 2023 12:31:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax/m-p/3023179#M102954</guid>
      <dc:creator>RickF83</dc:creator>
      <dc:date>2023-01-16T12:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax/m-p/3023244#M102961</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="382528" data-lia-user-login="RickF83" class="lia-mention lia-mention-user"&gt;RickF83&lt;/a&gt;&amp;nbsp;What is your expected output? If I am interpreting this correctly, you could do something like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
  VAR __Item = MAX('Table'[Item No_]
  VAR __CurrentDate = MAX('Table'[Document Date])
  VAR __FirstDate = MINX(FILTER(ALL('Table'),[Item No_] = __Item &amp;amp;&amp;amp; [PurchoseORSale] = "Purchase"),[Document Date])
  VAR __Purchases = SUMX(FILTER(ALL('Table'),[Document Date] &amp;gt;= __FirstDate &amp;amp;&amp;amp; [Document Date] &amp;lt;= __CurrentDate &amp;amp;&amp;amp; [PurchaseORSale] = "Purchase"),[Invoiced Quantity])
  VAR __Sales = SUMX(FILTER(ALL('Table'),[Document Date] &amp;gt;= __FirstDate &amp;amp;&amp;amp; [Document Date] &amp;lt;= __CurrentDate &amp;amp;&amp;amp; [PurchaseORSale] = "Sale"),[Invoiced Quantity])
  VAR __Result = __Purchase - __Sales
RETURN
  __Result&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 16 Jan 2023 13:05:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax/m-p/3023244#M102961</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2023-01-16T13:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax/m-p/3023458#M102976</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;its coming up with an error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The syntax for 'VAR' is incorrect. (DAX( VAR __Item = MAX('Item Ledger Entry'[Item No_] VAR __CurrentDate = MAX('Item Ledger Entry'[Document Date]) VAR __FirstDate = MINX(FILTER(ALL('Item Ledger Entry'),[Item No_] = __Item &amp;amp;&amp;amp; [PurchoseORSale] = "Purchase"),[Document Date]) VAR __Purchases = SUMX(FILTER(ALL('Item Ledger Entry'),[Document Date] &amp;gt;= __FirstDate &amp;amp;&amp;amp; [Document Date] &amp;lt;= __CurrentDate &amp;amp;&amp;amp; [PurchaseORSale] = "Purchase"),[Invoiced Quantity]) VAR __Sales = SUMX(FILTER(ALL('Item Ledger Entry'),[Document Date] &amp;gt;= __FirstDate &amp;amp;&amp;amp; [Document Date] &amp;lt;= __CurrentDate &amp;amp;&amp;amp; [PurchaseORSale] = "Sale"),[Invoiced Quantity]) VAR __Result = __Purchase - __SalesRETURN __Result)).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the expected out put is to see where items have gone out of stock, so I can fill in the OOS Days and calculate predicted lost sales.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 14:17:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax/m-p/3023458#M102976</guid>
      <dc:creator>RickF83</dc:creator>
      <dc:date>2023-01-16T14:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax/m-p/3023652#M102993</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="382528" data-lia-user-login="RickF83" class="lia-mention lia-mention-user"&gt;RickF83&lt;/a&gt;&amp;nbsp;Missed a paren:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
  VAR __Item = MAX('Table'[Item No_])
  VAR __CurrentDate = MAX('Table'[Document Date])
  VAR __FirstDate = MINX(FILTER(ALL('Table'),[Item No_] = __Item &amp;amp;&amp;amp; [PurchoseORSale] = "Purchase"),[Document Date])
  VAR __Purchases = SUMX(FILTER(ALL('Table'),[Document Date] &amp;gt;= __FirstDate &amp;amp;&amp;amp; [Document Date] &amp;lt;= __CurrentDate &amp;amp;&amp;amp; [PurchaseORSale] = "Purchase"),[Invoiced Quantity])
  VAR __Sales = SUMX(FILTER(ALL('Table'),[Document Date] &amp;gt;= __FirstDate &amp;amp;&amp;amp; [Document Date] &amp;lt;= __CurrentDate &amp;amp;&amp;amp; [PurchaseORSale] = "Sale"),[Invoiced Quantity])
  VAR __Result = __Purchase - __Sales
RETURN
  __Result&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 16 Jan 2023 15:39:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax/m-p/3023652#M102993</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2023-01-16T15:39:18Z</dc:date>
    </item>
  </channel>
</rss>

