Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear All, We have a requirement to create a Days Cover formula. Attached the sample file. Could anyone help me on the calculation? Thanks, Srini.
Are the first 13 rows in the Excel how your data looks like? If it is, why can't you just do this If(Demand Date = Stock Date, Days Cover)? I mean I am not sure what the complication is?
Hi @sunny_talwar,
Sorry for the confusion.
The column from A to I is available.
But the other columns need to be derived and the final output as per row 18 should be created.
Hope it is clear now.
Attached the updated file as per the comments.
Thanks,
Srini.
These needed to be calculated in the script or on the front end of the app? Also, you need to see just the two rows with Days Cover = 4 or do you need all rows to say Days Cover = 4 for Stock Date = 1/13/2019?
For Stock Date 1/14/2019, I am getting Days cover of 1 because my demand calculation is 196 for Demand date 1/14 and 1/15, why do you have 0?
Leaving that issue aside, I did it in the front end and got this
Expressions
Demand Cumm
=Aggr(RangeSum(Above(Sum(Demand), 0, RowNo())), [Stock Date], [Demand Date])
Demand vs. Stock
=Stock - Aggr(RangeSum(Above(Sum(Demand), 0, RowNo())), [Stock Date], [Demand Date])
Stock Out Flag
=If(Stock - Aggr(RangeSum(Above(Sum(Demand), 0, RowNo())), [Stock Date], [Demand Date]) < 0, 1, 0)
Stock Out date
=If(Stock - Aggr(RangeSum(Above(Sum(Demand), 0, RowNo())), [Stock Date], [Demand Date]) < 0, Null(), [Demand Date])
Max Stock Out Date
=Max(TOTAL <[Stock Date]> Aggr(If(Stock - Aggr(RangeSum(Above(Sum(Demand), 0, RowNo())), [Stock Date], [Demand Date]) < 0, Null(), [Demand Date]), [Stock Date], [Demand Date]))
Days Cover
=Max(TOTAL <[Stock Date]> Aggr(If(Stock - Aggr(RangeSum(Above(Sum(Demand), 0, RowNo())), [Stock Date], [Demand Date]) < 0, Null(), [Demand Date]), [Stock Date], [Demand Date])) - [Stock Date]