Forum Discussion
FIFO Stock
Hi
Have been looking at some posts and cannot find the solution for this. I have a purchase fact table like below
If the UnitsInStock is 800, I need a DAX measure for calculation Qty_Stock like below?
By the way the UnitsInStock can differ to my selection of date. (see measure below)
Is there a possible solution for this?
Itemnumber Date QTY bought Qty_Stock
23 20-06-2019 600 600
23 18-05-2019 50 50
23 23-04-2019 1000 150
UnitsInStock:=
IF (
MIN ( 'DIM_Time'[DateValue] ) <= CALCULATE ( MAX ( 'Fact_Inventory'[PostingDate] ); ALL ( 'Fact_Inventory' ) );
CALCULATE (
SUM ( 'Fact_Inventory'[Quantity] );
FILTER (
ALL( 'DIM_Time'[DateValue]);
'DIM_Time'[DateValue] <= MAX ( 'DIM_Time'[DateValue] )
)
)
)
5 Replies
- AnonymousNot applicable
Please formulate your question in a very clear fashion so that everyone (not only you) can understand it. Then maybe someone will be able to help you.
Thanks.
Best
Darek
- Dennis_PedersenHelper I
Okay - if I for example have chosen today(from DIM_time) the UnitsInStock measure may give me a figure of 800 pcs. in Stock.
I would like to split this figure into 3 purchases according to my fact Purchase table like the column at the right.
Is that possible?
- Dennis_PedersenHelper I
Has anybody had this challenge and found a solution?