Forum Discussion
brunofs123
7 years agoFrequent Visitor
Help with final balance (stock calculation)
Hello fellow pbi users! My dataset is here I need to calculate dynamically the qty stock left in my inventory and $ total amount of this inventory left : units remaning of that product * un...
v-piga-msft
Resident Rockstar
7 years agoHi brunofs123 ,
I still have a little confused about your scenario.
For your first problem, I cannot understand that why the correct total is 44.810, could you explain it?
In addition, for your sceond problem, it seems that the remaining for POSMIL product should be -100 based on your data sample. What is your desired output?
Best Regards,
Cherry
brunofs123
7 years agoFrequent Visitor
Hi there!
1) For your first problem, I cannot understand that why the correct total is 44.810, could you explain it?
With no filter dates applied, i would have:
My inventory balance [$ IN STOCK LEFT] should be the price bought for the item * units i have LEFT of that item
I think in my measure it was incorrect. I've changed like below:
unit price last BUY = CALCULATE(MAX(Total[UNITY VALUE]);Total[TIPO]= "BUY";
FILTER (
ALLSELECTED( 'Calendario'[Date] );
'Calendario'[Date] <= MAX( Calendario[Date] )
))
But it still results in not expected value:
****
2) it seems that the remaining for POSMIL product should be -100 based on your data sample. What is your desired output?
Should be 300:
Bought: 300 on 09-04-19
Sold: 100 only on 25-04-19, so my balance is still 300 on 21-04-2019.
I kinda feel dumb right now because the measure it's poorly written. I should have make a accumulated sum.
Thanks for your patience!