<?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: Inventory list value from prices in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Inventory-list-value-from-prices/m-p/4080859#M161995</link>
    <description>&lt;P&gt;Hi Leroy Lu,&lt;BR /&gt;&lt;BR /&gt;Measure works great. On a few items I don't get the reponse as expected, but that's due to something in the dataset. Thank you for your help.&lt;/P&gt;</description>
    <pubDate>Mon, 05 Aug 2024 09:59:51 GMT</pubDate>
    <dc:creator>SvenvandenHil</dc:creator>
    <dc:date>2024-08-05T09:59:51Z</dc:date>
    <item>
      <title>Inventory list value from prices</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Inventory-list-value-from-prices/m-p/4073863#M161745</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;We have an inventory list and for each item you can see how much the inventory changes per date and location.&lt;BR /&gt;I already made a PBI for the quantity of each item on specific dates, but next to that we want to see the value of every item on a specific date.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have a table with all prices per item, but every price haves an activation date. So if I need to calculate the value of the inventory on a specific date I need the price of the activation date. But there aren't any end dates in this price table. So only the start date.&lt;BR /&gt;&lt;BR /&gt;Next to that there are some more thing which should be considered in the calculation.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;An Item can be on multiple locations, but for every location we could have other prices, for now we only have 2 locations (1 and 2) The locations are also in the InventoryTransactions table&lt;/LI&gt;&lt;LI&gt;An item has a PriceUnit, so the price is per 1 or per 5 or per 1000. So if the inventory changes with 500 units and the price is per 1000 this should be calculated correctly&lt;/LI&gt;&lt;LI&gt;There is also a PriceType. An item could have 2 PriceTypes (0 and 1) If so PriceType 1 is leading. But if 1 isn't available the calculation should be done with PriceType 0.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;And at last there is the ActivationDate, the calculations for the value of the inventory should be done on the price that's active in the chosen period. As an example you have item 10002848 and it's price with activation date 1-1-2023 is 1,00 per item. And I have the same item priced on activation date 1-1-2024 for 1,05 per item. All transactions done in 2023 should be for the price of 1,00 per item. So if I filter on date 30-06-2023 I should see all inventory changes untill that date for 1,00 per item. But if I filter until 30-06-2024 than all inventory changes should be against the 1,05 per item. So also the changes in 2023. So the filter should look up the value which is active in that same period and should calculate all inventory transactions with that value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please see below links to example files of the transactions and price tables&lt;/P&gt;&lt;P&gt;&lt;A href="https://kijlstrabestratingnl-my.sharepoint.com/:u:/g/personal/s_vandenhil_kijlstra-bestrating_nl/EegbmVpCKftBpVJB7wKpttIB5TOwVRMgAMkFsgT21Pl82w?e=bhNyr4" target="_blank" rel="noopener"&gt;Pbix file&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;A href="https://kijlstrabestratingnl-my.sharepoint.com/:x:/g/personal/s_vandenhil_kijlstra-bestrating_nl/ESqTvWScxQFMvK_9y6AAMhIBOSbZ3bGSywghyZXC77l2Qg?e=h6x5NV" target="_blank" rel="noopener"&gt;xlsx file&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 14:46:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Inventory-list-value-from-prices/m-p/4073863#M161745</guid>
      <dc:creator>SvenvandenHil</dc:creator>
      <dc:date>2024-08-01T14:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Inventory list value from prices</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Inventory-list-value-from-prices/m-p/4074949#M161783</link>
      <description>&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="766425" data-lia-user-login="SvenvandenHil" class="lia-mention lia-mention-user"&gt;SvenvandenHil&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Regarding the issue you raised, my solution is as follows:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;1.&lt;/SPAN&gt;&lt;SPAN&gt;First, I created a time calculation table as a slicer:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Time = 
CALENDAR (
    MIN (
        MIN ( 'InventItemPriceStaging'[ACTIVATIONDATE] ),
        MIN ( 'MainInventoryTransactions'[Inventory Physical Date] )
    ),
    MAX (
        MAX ( 'MainInventoryTransactions'[Inventory Physical Date] ),
        MAX ( 'MainInventoryTransactions'[Inventory Physical Date] )
    )
)&lt;/LI-CODE&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;2. Below are the measure I've created for your needs：&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;MEASURE = 
VAR select1 =
    MAX ( 'Time'[Date] )
VAR type1 =
    CALCULATE (
        MAX ( 'InventItemPriceStaging'[PRICETYPE] ),
        FILTER (
            ALLEXCEPT (
                'InventItemPriceStaging',
                'InventItemPriceStaging'[ITEMID],
                'InventItemPriceStaging'[LOCATION]
            ),
            'InventItemPriceStaging'[ACTIVATIONDATE] &amp;lt;= select1
        )
    )
VAR unit1 =
    CALCULATE (
        MAX ( 'InventItemPriceStaging'[PRICEUNIT] ),
        ALLEXCEPT (
            InventItemPriceStaging,
            'InventItemPriceStaging'[ITEMID],
            'InventItemPriceStaging'[LOCATION]
        )
    )
VAR price1 =
    CALCULATE (
        MAX ( 'InventItemPriceStaging'[PRICE] ),
        FILTER (
            ALLEXCEPT (
                'InventItemPriceStaging',
                'InventItemPriceStaging'[ITEMID],
                'InventItemPriceStaging'[LOCATION]
            ),
            'InventItemPriceStaging'[ACTIVATIONDATE] &amp;lt;= select1
                &amp;amp;&amp;amp; 'InventItemPriceStaging'[PRICETYPE] = type1
        )
    )
VAR price2 = price1 / unit1
VAR cid =
    MAX ( 'InventItemPriceStaging'[ITEMID] )
VAR cl =
    MAX ( 'InventItemPriceStaging'[LOCATION] )
VAR inventor =
    CALCULATE (
        SUM ( MainInventoryTransactions[Quantity Inventory Unit] ),
        FILTER (
            'MainInventoryTransactions',
            'MainInventoryTransactions'[Inventory Physical Date] &amp;lt;= select1
                &amp;amp;&amp;amp; 'MainInventoryTransactions'[ITEMID] = cid
                &amp;amp;&amp;amp; 'MainInventoryTransactions'[LOCATION] = cl
        )
    )
RETURN
    inventor * price2&lt;/LI-CODE&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;3.Here's my final result, which I hope meets your requirements.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="zh-CN"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Please find the attached pbix relevant to the case.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Leroy Lu&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;If this post &lt;SPAN&gt;helps&lt;/SPAN&gt;, then please consider Accept it &lt;SPAN&gt;as the solution &lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 04:02:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Inventory-list-value-from-prices/m-p/4074949#M161783</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-02T04:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: Inventory list value from prices</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Inventory-list-value-from-prices/m-p/4080859#M161995</link>
      <description>&lt;P&gt;Hi Leroy Lu,&lt;BR /&gt;&lt;BR /&gt;Measure works great. On a few items I don't get the reponse as expected, but that's due to something in the dataset. Thank you for your help.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2024 09:59:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Inventory-list-value-from-prices/m-p/4080859#M161995</guid>
      <dc:creator>SvenvandenHil</dc:creator>
      <dc:date>2024-08-05T09:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: Inventory list value from prices</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Inventory-list-value-from-prices/m-p/4122901#M163698</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi Leroy Lu,&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;The formula still works like a charm, but as expected I can't seem to get totals. This is due to that the formula is searching the MAX price belonging to the itemID, only the total row doesn't have an itemID which makes that the DAX formula just chooses the MAX price from the whole table and calculate with that price. Do you know any solution or work around for getting the correct totals?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 13:49:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Inventory-list-value-from-prices/m-p/4122901#M163698</guid>
      <dc:creator>SvenvandenHil</dc:creator>
      <dc:date>2024-08-28T13:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Inventory list value from prices</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Inventory-list-value-from-prices/m-p/4123828#M163751</link>
      <description>&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;FONT&gt;Hi,&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="766425" data-lia-user-login="SvenvandenHil" class="lia-mention lia-mention-user"&gt;SvenvandenHil&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Regarding the issue you raised, my solution is as follows:&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;&lt;FONT&gt;In response to your question, I offer two approaches:&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;FONT&gt;&lt;SPAN&gt;1.&lt;/SPAN&gt;&lt;SPAN&gt;The first is to use the HASONEFILTER () function as the basis for judgment, and then output the SUMX () function as the aggregate.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Here are the related links, I hope you will be helpful:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&lt;FONT&gt;&lt;A href="https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376" target="_blank"&gt;&lt;SPAN&gt;Dealing with Measure Totals - Microsoft Fabric Community&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907" target="_blank"&gt;&lt;SPAN&gt;Measure Totals, The Final Word - Microsoft Fabric Community&lt;/SPAN&gt;&lt;/A&gt;&lt;/FONT&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;FONT&gt;&lt;SPAN&gt;2.&lt;/SPAN&gt;&lt;SPAN&gt;The second is to convert the measures into groups of calculations and then modify the aggregation:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;FONT&gt;&lt;SPAN&gt;Y&lt;/SPAN&gt;&lt;SPAN&gt;ou can try the following code as a calculated column:&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;&lt;FONT&gt;Then modify the way it&amp;nbsp;&lt;/FONT&gt;&lt;FONT&gt;aggregates:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Leroy Lu&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;If this post &lt;SPAN&gt;helps&lt;/SPAN&gt;, then please consider Accept it &lt;SPAN&gt;as the solution &lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 01:54:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Inventory-list-value-from-prices/m-p/4123828#M163751</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-29T01:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Inventory list value from prices</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Inventory-list-value-from-prices/m-p/4124287#M163768</link>
      <description>&lt;P&gt;Hi Leroy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have an example for one or both of these solutions?&lt;BR /&gt;&lt;BR /&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sven&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 06:43:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Inventory-list-value-from-prices/m-p/4124287#M163768</guid>
      <dc:creator>SvenvandenHil</dc:creator>
      <dc:date>2024-08-29T06:43:45Z</dc:date>
    </item>
  </channel>
</rss>

