Skip to main content

Notifications

Supply chain | Supply Chain Management, Commerce
Unanswered

Inventory Value Storage Report - How to replicate logic in PowerBI?

Posted on by 8
Hello there. I need to replicate the inventory value report in a PowerBI dashboard. I was able to replicate the inventory value for each item and total value only on the current date. If I run the report on today's date, it matches perfectly with my PowerBI.
However, if I filter back in time, there is a mismatch between what I calculate and what the report shows. I assume there is a logic I am missing, can anyone please advice?

This is my PowerBI measure to calculate the InventoryValue based on the InventTrans data.
InventoryValue = 
VAR SelectedDate = [SelectedDate]
RETURN
SUMX(
    'InventTrans',
    IF(
        ('InventTrans'[StatusIssue] IN {"None", "Sold"} && 
        'InventTrans'[StatusReceipt] IN {"None", "Purchased"}) &&
        ('InventTrans'[DateFinancial]  <= SelectedDate &&
        'InventTrans'[DateFinancial] <> DATE(1900,1,1) + TIME(12,0,0)),
        'InventTrans'[CostAmountPosted] + 'InventTrans'[CostAmountAdjustment],
        IF(
            ('InventTrans'[StatusIssue] IN {"None", "Sold" , "Deducted"} &&
            'InventTrans'[StatusReceipt] IN {"None", "Purchased", "Received"}) &&
            'InventTrans'[DatePhysical] <= SelectedDate,
            'InventTrans'[CostAmountPhysical],
            0
        )
    )
)
The logic is the following:
"For each row, sum the CostAmountPosted + CostAmountAdjustment if there is a DateFinancial and its before the currently selected date and the transaction's status is Sold or Purchased.
Else, if the DatePhysical is before the SelectedDate and matches as Sold/Deducted and Purchased/Received, then use just CostAmountPhysical"


I have created a filtering DateFilter column with the following logic:
CAST(
    CASE
        WHEN it.DateFinancial <> '1900-01-01 12:00:00 +00:00' AND it.DateFinancial < it.DatePhysical 
            THEN it.DateFinancial
        ELSE it.DatePhysical
    END AS datetimeoffset
) AS DateFilter
"If there is a DateFinancial and it's before the DatePhysical, then this will be where my transaction's date becomes valid, else use DatePhysical"

With this, DateFilter is used to filter down the transactions rows which were available on a certain SelectedDate.

I think there is an addittional logic on when to sum the AdjustmentCost probably. Thanks in advance for your help! :D
 
  • VaHiX Profile Picture
    VaHiX 2,454 on at
    Inventory Value Storage Report - How to replicate logic in PowerBI?
    Ensure that the timing of the adjustment costs is correctly accounted for. In Dynamics 365, adjustments might be applied retroactively, affecting the inventory value on previous dates. You might need to include logic to handle these retroactive adjustments.
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,902 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,336 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans