Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi everyone!
I have been working on a series of measures to determine how many weeks my inventory is expected to last when paired with a weekly sales forecast.
I have a starting or current inventory quantity and an estimated forecast by week.
I created a measure to calculate the running total of the forecast quantity:
then another to invert the running total:
and then another measure to calculate the sum of the forecast against the current inventory quantity over each week listed in the forecast (realizing I could probably combine these two into one but trying to piece this all together step by step):
SKU# | Forecast Date | Sum of Forecast Quantity | ForecastQTYRunningTotal | ForecastInv | InvRemaining | Is_InvRemaining_+ |
36 | 1/18/2021 | 2494 | 2494 | -2494 | 12985 | yes |
36 | 1/25/2021 | 2452 | 4946 | -4946 | 10533 | yes |
36 | 2/1/2021 | 2798 | 7744 | -7744 | 7735 | yes |
36 | 2/8/2021 | 2920 | 10664 | -10664 | 4815 | yes |
36 | 2/15/2021 | 2364 | 13028 | -13028 | 2451 | yes |
36 | 2/22/2021 | 2228 | 15256 | -15256 | 223 | yes |
36 | 3/1/2021 | 2386 | 17642 | -17642 | -2163 | no |
36 | 3/8/2021 | 2140 | 19782 | -19782 | -4303 | no |
36 | 3/15/2021 | 2090 | 21872 | -21872 | -6393 | no |
36 | 3/22/2021 | 2120 | 23992 | -23992 | -8513 | no |
36 | 3/29/2021 | 2868 | 26860 | -26860 | -11381 | no |
36 | 4/5/2021 | 2734 | 29594 | -29594 | -14115 | no |
Solved! Go to Solution.
@dgwoodard , Try like
measure =
var _tab = addcolumns(summarize(Table, Table[SKU#], Table[Forecast Date), "_1",[InvRemaining])
return
countx(_tab, if([_1]>0,1,blank())
Also worth noting that I have a slicer filtering the data table and measures by SKU # in order to isolate the detail of each product.
@dgwoodard , Try a measure like
measure =
var _tab = addcolumns(summarize(Table, Table[SKU#], Table[Forecast Date), "_1",[InvRemaining])
return
countx(_tab, if(_tab[_1]>0,1,blank())
I feel like this is really close to success but getting an error of "Cannot find table '_tab'."
@dgwoodard , Try like
measure =
var _tab = addcolumns(summarize(Table, Table[SKU#], Table[Forecast Date), "_1",[InvRemaining])
return
countx(_tab, if([_1]>0,1,blank())
Sucess! - thank you.
User | Count |
---|---|
140 | |
113 | |
104 | |
76 | |
63 |
User | Count |
---|---|
135 | |
126 | |
110 | |
70 | |
61 |