Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
spividori
Specialist
Specialist

Max and Min date

Hi.

In my application I need to calculate the variation between the first and last Price for each product entered in the selected period.

Attached file example, in which when I select a product works perfect but when it is more than one product, it does not work.

Regards.

1 Solution

Accepted Solutions
sunny_talwar

Try with firstSortedValue() function

FirstSortedValue(Aggr(Sum(Precio), NumFecha, Producto), Aggr(NumFecha, NumFecha, Producto))


FirstSortedValue(Aggr(Sum(Precio), NumFecha, Producto), -Aggr(NumFecha, NumFecha, Producto))


FirstSortedValue(Aggr(Sum(Precio), NumFecha, Producto), -Aggr(NumFecha, NumFecha, Producto))/FirstSortedValue(Aggr(Sum(Precio), NumFecha, Producto), Aggr(NumFecha, NumFecha, Producto))-1

Capture.PNG

View solution in original post

4 Replies
sunny_talwar

Try with firstSortedValue() function

FirstSortedValue(Aggr(Sum(Precio), NumFecha, Producto), Aggr(NumFecha, NumFecha, Producto))


FirstSortedValue(Aggr(Sum(Precio), NumFecha, Producto), -Aggr(NumFecha, NumFecha, Producto))


FirstSortedValue(Aggr(Sum(Precio), NumFecha, Producto), -Aggr(NumFecha, NumFecha, Producto))/FirstSortedValue(Aggr(Sum(Precio), NumFecha, Producto), Aggr(NumFecha, NumFecha, Producto))-1

Capture.PNG

spividori
Specialist
Specialist
Author

It works perfectly. Thanks.

Regards.

spividori
Specialist
Specialist
Author

Hi.

More complicated, if I want to find the average, that is, the sum of the column "%" on count (Producto). In the example it would be: 260.09 / 13 = 20.01.

Regards.

sunny_talwar

Not entirely sure I follow