Skip to main content

Notifications

Announcements

No record found.

Supply Chain Management forum
Unanswered

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

Posted on by
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 1,331 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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 228,588 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans