Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

previous(inventory) sorting issue

Hi all,

           I am trying to calculate inventory turns (((this week inventory+ last week inventory)/2)/sales). To calculate the inventory I am using the previous(inventory) function so that I get the last week Inventory. But the issue is I have many dimensions where I will be using apart from the week dimesion. for ex: dept, store, and few more. issue is with sorting of previous(inventory) it is no where related .

can anybody help me with this issue?

Thanks in advance

7 Replies
sunny_talwar

Do you have a sample app where you can show the issue?

Not applicable
Author

Hi I am attaching a test file as well. Please let me know your insights on this issue.

swuehl
MVP
MVP

What would be the expected result for your sample data?

In general, if you want to use Previous() / Peek() in the script, you need to order your data records accordingly and then you might need to check for changes in column segments (i,e, changes in Dimension values other than week number).

If you need to be dynamic with your inventory calculation (i.e. you can't calculate it in the script because it depends on selections / changing dimensions), you can use Above() chart inter record function, analog to Peek() in the script.

Not applicable
Author

Hi swuehl,

                 Can you please share the expression?

Not applicable
Author

Hi guys,

             I am attaching the expected result set

Thanks

sunny_talwar

I don't see the store, dept...etc information in the qvw, but those are used as dimensions in your excel file. Not sure if I can replicate the Excel into your qvw without all the fields.

Not applicable
Author

Hi Sunny,

                I have uploaded the latest copy with all the dimensions