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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
sritter_sellvin
New Member

Calculate inventory for each day

Hey all,

 

i have a problem to calculate the inventory for each day by sum the stock movements.

 

My structure looks like this:

structure.png

 

Item -> Products (60.000 Rows)

ItemBinLog -> Stockmovements (10.000.000 Rows)

ItemBinLogDate -> Datetable from 01.01.2012 to Today

 

Some Data from the Stockmovements:

ID (of stockmovement)Storage-binQuantityItemMovementdate
72174344962112010684418.11.2019 00:00:00
72174694923712010684418.11.2019 00:00:00
72174994923912010684418.11.2019 00:00:00
721751149242120106844  18.11.2019 00:00:00
72175364925012010684418.11.2019 00:00:00
72176974963212010684418.11.2019 00:00:00
72175805623713210684418.11.2019 00:00:00
721663360610120010684418.11.2019 00:00:00
721871160610-120010684418.11.2019 00:00:00
722066546703120010684418.11.2019 00:00:00
722908256237-110684420.11.2019 00:00:00
722908356237-110684420.11.2019 00:00:00
723184046703-32810684420.11.2019 00:00:00
72318394670232810684420.11.2019 00:00:00

 

To calculate the inventory for a day we have to sum all the movements <= the expected date.

The problem is to get the inventory for dates where no movements exists like the 2019-11-19 (19.11.2019)

 

Thanks for you help

Sebastian

1 ACCEPTED SOLUTION
sritter_sellvin
New Member

I got the right solution:

 

CALCULATE(SUM(ItemBinLog[Qty]); FILTER(ALL(ItemBinLogDate); ItemBinLogDate[date] <= MAX(ItemBinLogDate[date])))

View solution in original post

2 REPLIES 2
sritter_sellvin
New Member

I got the right solution:

 

CALCULATE(SUM(ItemBinLog[Qty]); FILTER(ALL(ItemBinLogDate); ItemBinLogDate[date] <= MAX(ItemBinLogDate[date])))

RohiniP-26
Resolver I
Resolver I

sum= CALCULATE(SUM('Stockmovements'[Quantity]),FILTER('Stockmovements','Stockmovements'[MovementDate]<=EARLIER('Stockmovements'[MovementDate])))
it will work irrespective of presence or absence of date

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors