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

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

show the latest available value

Hi,

I am tracking price fluctuations in products we purchase through our head office which are effected by volume based pricing.

Any items that have a price adjustment are listed in a file which is loaded into Qlikview. At present we have a few years worth of data listed by month and product.

If there is a blank field in a given month it means that there was no change in the price in that period.

I want to take the current table showing all the months and list only the most recent price regardless of which period it is in. Often the lastest period could be blank (no change) so I want it to go back to the last value and return that price.

Please see a mock up below, the top table is what we currently see, the bottom is what I'd like to also show.

ItemMonthsJanFebMarAprMay
Product11.21.271.241.25
Product25.265.335.215.28
Product33.493.533.44
Product40.590.610.640.63
ItemLatest Price
Product11.25
Product25.28
Product33.44
Product40.63

Thanks

David

Labels (1)
2 Replies
phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

See if the attached helps..

Incase if you cant open the attached...

UI Expression :  FirstSortedValue(NEW_VAL,-Sort)

Dimension: Item

//Script....

Data:

load * inline [

Item,Month,Price

Product1,Jan,1.2

Product1,Feb,

Product1,Mar,1.27

Product1,Apr,1.24

Product1,May,1.25

Product2,Jan,5.26

Product2,Feb,5.33

Product2,Mar,5.21

Product2,Apr,5.28

Product2,May,

Product3,Jan,3.49

Product3,Feb,3.53

Product3,Mar,3.44

Product3,Apr,

Product3,May,

Product4,Jan,0.59

Product4,Feb,0.61

Product4,Mar,

Product4,Apr,0.63

Product4,May,0.64

];

Data_Transformed:

load *, IF (Item=PEEK('Item') AND len(Price)=0,PEEK('NEW_VAL'),Price) AS NEW_VAL Resident Data order by Item asc;

Drop table Data;

Month:

Load * Inline [

Month, Sort

Jan,1

Feb,2

Mar,3

Apr,4

May,5

];

Not applicable
Author

hi

try this

a:

CrossTable(month,value)

LOAD item,

     Jan,

     Feb,

     Mar,

     Apr,

     May

FROM

(ooxml, embedded labels, table is Sheet1);

LOAD item,

    MAX(date(DATE#(month,'MMM'),'MMM')) as max_month,

    FirstSortedValue(value,-date(DATE#(month,'MMM'),'MMM')) as latest_price

    Resident a

    Group BY item ;

then output like this--

itemlatest_price
p11.25
p25.28
p33.44
p40.63

or