Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
leafbear024
New Member

How to make the Stock inventory log list as my requirement (Inventory on hand)

Inventory on Hand is a manual table calculate as below formula: 

 

Inventory on HandCALCULATE (SUM ( ItemInOutHistoryList[No_of_Rolls] ),ItemInOutHistoryList[Posting_Date],
DATESBETWEEN (ItemInOutHistoryList[Posting_Date],DATE ( 2021, 01, 01 ),MINX (ALLSELECTED ( ItemInOutHistoryList ),'ItemInOutHistoryList'[Posting_Date]) - 1))

 

I would like to create a report as below :

 

Now my output is like that:

Posting Dateitem_NoInventory on HandNo of Rolls
07/31/2021M000136-12
08/06/2021M000136-14
08/09/2021M000136-4
08/10/2021M000136-6
Total 36-36

 

Expected output is like that:

Posting Dateitem_NoInventory on HandNo of Rolls
07/31/2021M000136-12
08/06/2021M000124-14
08/09/2021M000110-4
08/10/2021M00016-6
Total 0-36

 

how can I save the previous value and carry it to next day ....

 

1 ACCEPTED SOLUTION

Thanks for reply.  I will try to use your solution later :D.

 

However,  I finally solve this problem as below:

Inventory on Hand = CALCULATE(SUM('ItemInOutHistoryList'[No_of_Rolls]),FILTER('ItemInOutHistoryList','ItemInOutHistoryList'[Location_Code] = EARLIER('ItemInOutHistoryList'[Location_Code]) && 'ItemInOutHistoryList'[Item_No]=EARLIER('ItemInOutHistoryList'[Item_No]) && 'ItemInOutHistoryList'[Posting_Date].[Date]<= EARLIER('ItemInOutHistoryList'[Posting_Date].[Date]) - 1))

 

Result as below:

leafbear024_2-1631095188384.png

 

 

 

View solution in original post

3 REPLIES 3
v-kkf-msft
Community Support
Community Support

Hi @leafbear024 ,

 

Is your model like this?

image.png


Then try the following formula:

 

Measure = 
var Pre = 
    CALCULATE(
        SUM(ItemInOutHistoryList[No of Rolls]),
        FILTER(
            ALLSELECTED(ItemInOutHistoryList[Posting Date]),
            ItemInOutHistoryList[Posting Date] < MAX(ItemInOutHistoryList[Posting Date])
        )
    )
return 
    IF(
        ISFILTERED(ItemInOutHistoryList[Posting Date]),
        SUM('Inventory on Hand'[Inventory on Hand]) + Pre,
        SUM('Inventory on Hand'[Inventory on Hand]) + SUM(ItemInOutHistoryList[No of Rolls])
    )

image.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for reply.  I will try to use your solution later :D.

 

However,  I finally solve this problem as below:

Inventory on Hand = CALCULATE(SUM('ItemInOutHistoryList'[No_of_Rolls]),FILTER('ItemInOutHistoryList','ItemInOutHistoryList'[Location_Code] = EARLIER('ItemInOutHistoryList'[Location_Code]) && 'ItemInOutHistoryList'[Item_No]=EARLIER('ItemInOutHistoryList'[Item_No]) && 'ItemInOutHistoryList'[Posting_Date].[Date]<= EARLIER('ItemInOutHistoryList'[Posting_Date].[Date]) - 1))

 

Result as below:

leafbear024_2-1631095188384.png

 

 

 

amitchandak
Super User
Super User

@leafbear024 ,a new column like

 

new column = [Inventory on Hand] + sumx(filter(Table, [item_no] = earlier([item_no]) && [Posting_date] = earlier([posting_date])), [No of Rolls])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors