Forum Discussion
Pull from Random Bin
Awesome!
This is working perfectly, thank you so much!
Now I have one additional question if you don't mind -
In an ideal world, I would have two additional columns. One for if there is only 1 location, another for 2 locations. I attempted to copy and paste the code sections to repeat this, however, it is not working. Can you see what is wrong with it?
[Your Table] = // calculated table
generate(
allnoblankrow( Orders[OrderId], Orders[SKU] ),
// Now, we'll be randomly pulling
// a Location number from the new
// table. Call it SKULocationLottery.
var ThreeLocationId = randbetween(1, 3)
var CurrentSKU = Orders[SKU]
var ThreeLocationNumber =
lookupvalue(
SKULocationLottery[Location Number],
SKULocationLottery[Location ID], ThreeLocationId,
SKULocationLottery[SKU], CurrentSKU,
-1 // this should not happen!
)
var TwoLocationId = randbetween(1, 2)
var TwoLocationNumber =
lookupvalue(
SKULocationLottery[Location Number],
SKULocationLottery[Location ID], TwoLocationId,
SKULocationLottery[SKU], CurrentSKU,
-1 // this should not happen!
)
var OneLocationId = 1
var OneLocationNumber =
lookupvalue(
SKULocationLottery[Location Number],
SKULocationLottery[Location ID], OneLocationId,
SKULocationLottery[SKU], CurrentSKU,
-1 // this should not happen!
)
return
row( "Three Locations Number", ThreeLocationNumber, "Two Locations Number", TwoLocationNumber, "On Locations Number", OneLocationNumber, )
If anyone is able to help, still struggling with getting multiple options here. Thanks a bunch!