Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Previous price by article

Hello community,

I'm trying to find out the price differences by articles from our sales table.

The fields uses are

orderid

orderdate

articleid

price

amount


I need to show the difference concerning the price from the "current" order  to the previous order. If an article is sold more often also only the last order vs. last order -1 is relevant. Has someone a hint for my how to implement this in loading script?

Thanks in advance

Aloah

6 Replies
Not applicable

Previous price by article

hi,

you can create a new tablebox  (ordrid, aticleid, price). go to properties and sort descending ordid. make sure to make a selection on the last articlid somewhere on the sheet. you should see if there is a difference in the 2 first listed prices

IAMDV
Honored Contributor II

Previous price by article

Hi Aloah,

Is the "orderdate" field in your table a DateTime or just Date? Also, can you post some sample data and I can work an example for you.

Cheers - DV

Not applicable

Previous price by article

Hi DV,

orderdate is datetime.

Data looks like

orderid     orderdate                         articleid   price     amount

1             01.09.2011 00:00:00         a1              10             2

1             02.09.2011 00:00:00         a2              10             3

1             03.09.2011 00:00:00         a3              10             19

1             06.09.2011 00:00:00         a1              12             6

1             06.09.2011 00:00:00         a3              10             8

1             07.09.2011 00:00:00         a1              13             4

1             08.09.2011 00:00:00         a6              10             55

I'm trying to show within the chart that article a1 was bought last time with price 13 last previous order was with price 12. the order on 1.9.2011 with price of 10 isn't relevant. Only the current and the prev order are relevant.

eg.

last order with price 13 (+1) or something like that.

Thanks

Kind Regards


Aloah

IAMDV
Honored Contributor II

Re: Previous price by article

Hi Aloah,

Sorry for delay in replying back. Have you got this working? or do you still need help?

Thanks,

DV

Not applicable

Previous price by article

Hi DV,


I'm still looking for a solution.


Thanks


Aloah

MVP
MVP

Re: Previous price by article

Aloah

I have attached a demo using FirstSortedValue with your data. I think this does what you want.

Hope this helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Community Browser