Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Concat value based on prev value

Hi,

I cant solve this one so im posting my problem here, i think its a no brainer.

I Have this tabel:

BudgetRateDaily = wanted daily % decrease of stock.

daysFromLastReading = days from last reading of stock.

SKUdateinStockbudgetRateDaily%daysFromLastReading
Tshirt12013-09-0129011
Tshirt12013-10-01280130
Tshirt12013-11-01260230
Tshirt12013-12-01200230
Tshirt22013-09-0130031
Tshirt22013-10-01250330
Tshirt22013-11-01200230
Tshirt22013-12-01150230

And i want to add de field budgetStock

The thought is to calculate the wanted decrease (budget) by last budgetStock in date order:

SKUdateinStockbudgetRateDaily%daysFromLastReadingbudgetStockMY COMMENTS
Tshirt12013-09-0129011290First reading,stock and budget is the same
Tshirt12013-10-01280130230New budgetStock based on last budgetStock minus 1% daily in 30 days
Tshirt12013-11-01260230260The budgetRateDaily is changed and the budgetStock resets to inStock
Tshirt12013-12-01200230190New budgetStock based on last budgetStock minus 2% daily in 30 days
Tshirt22013-09-0130031300Nother SKU but same logic
Tshirt22013-10-01250330240
Tshirt22013-11-01200230200
Tshirt22013-12-01150230120

Is there any god way?

1 Solution

Accepted Solutions
jerem1234
Specialist II
Specialist II

I created a script, using your first table as an Inline table. Then I calculated your budgetStock field. Wasn't sure how you calculated budgetStock when the Rate Daily didn't change (you go from 290 - 230 for example). So I based it sort of off your comment to the right. Please find attached.

Hope this helps!

View solution in original post

2 Replies
jerem1234
Specialist II
Specialist II

I created a script, using your first table as an Inline table. Then I calculated your budgetStock field. Wasn't sure how you calculated budgetStock when the Rate Daily didn't change (you go from 290 - 230 for example). So I based it sort of off your comment to the right. Please find attached.

Hope this helps!

Not applicable
Author

thanks jerem1234 for a very useful and clear answer!