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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Show Value on Max Date

Hi,

I have a question regarding QlikView.

I have a data like this:

   

ProductDatePrice
A1/18/2018100
B1/15/2018200
B1/16/2018300

I want to create a pivot table that shown the latest date only for each product. For example for Product B there are two dates (1/15/2018 and 1/16/2018). I want to show maximum date of product B (1/16/2018)

So the result will be like this:

max date.PNG

But I also want to show the price on 1/16/2018. Can you help me to find the way ?

I also attached my sample file.

Thanks in advance.

1 Solution

Accepted Solutions
justinphamvn
Creator II
Creator II

Hi Chou,

Try like this measure:

FirstSortedValue(aggr(Sum(Price),Date,Product),-Date)

Hope this helps.

Justin.

View solution in original post

5 Replies
devarasu07
Master II
Master II

Hi,

Try below method,


Method 1:

Dimension:

Product

measure:

Max(aggr(sum(Price),Date))


Method 2:

Sum(Aggr(FirstSortedValue(Price, -Date), Product))   // best option

Capture.JPG

justinphamvn
Creator II
Creator II

Hi Chou,

Try like this measure:

FirstSortedValue(aggr(Sum(Price),Date,Product),-Date)

Hope this helps.

Justin.

Anonymous
Not applicable
Author

Hi Devarasu,

Thanks for your answer.

But I want to show the price on max(date) not max(price)

so if i change the data like this :

ProductDatePrice
A1/18/2018100
B1/15/2018300
B1/16/2018200

The price of product B must be 200 on 1/16/2018

Thanks

devarasu07
Master II
Master II

Hi,

this method should work for u. give a try

Sum(Aggr(FirstSortedValue(Price, -Date), Product))


Capture.JPG

Thanks

Deva

Anonymous
Not applicable
Author

Hi,

Thank you very much. It solved my problem perfectly.