Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calculate number of days how long inventory lasts?

Hello all,

I need to calculate the number of days how long the current inventory lasts if nothing comes in.

My fact table is the following:

DateInventory BalanceDemand Forecast
2016-01-01400200
2016-01-02600400
2016-01-03700300
2016-01-04200
2016-01-05100
2016-01-0680
2016-01-07400
2016-01-08200

It should take the lastest value from Inventory Balance ( =700) and calculate how many days the Balance lasts with the forecasted demand.

The correct answer with the data above should be 3 (700-200-100-80)

I'd like to do this in the visualization side, not in scripting. The reason is that I might have a product dimension and to be able to see the value with a selection of products.

How to do this? The result should be displayed in a text box.

Thanks in advance,

Petteri

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Sane way? Probably not...

View solution in original post

5 Replies
Gysbert_Wassenaar

I don't know of any sane way to do this without changing the load script. Perhaps Stefan‌ knows a way.


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

Sane way? Probably not...

Anonymous
Not applicable
Author

Thanks!

It worked!!

Cheers, Petteri

sunny_talwar

Damn it!!, I was so close, but had to jump on a call. I am glad I was moving in the right direction

swuehl
MVP
MVP

Petteri,

glad that it works for your. I guess there are better way to solve your request, maybe with some small changes to the data model.

I guess the last inventory balance and the demand forecast is not changing with user selections per specific product?

So maybe it's possible to calculate your requested outcome already in the script, or at least part of the information used in my expression.

Best,

Stefan