Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
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

Tags (1)
7 Replies

Re: previous(inventory) sorting issue

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

Not applicable

Re: previous(inventory) sorting issue

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

MVP
MVP

Re: previous(inventory) sorting issue

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

Re: previous(inventory) sorting issue

Hi swuehl,

                 Can you please share the expression?

Not applicable

Re: previous(inventory) sorting issue

Hi guys,

             I am attaching the expected result set

Thanks

Re: previous(inventory) sorting issue

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

Re: previous(inventory) sorting issue

Hi Sunny,

                I have uploaded the latest copy with all the dimensions