Try something like this (writing from memory, so verify the syntax):
, date, id)
The Above() function with 4 should give you the last 4 entries, and the rangemin should get the minimum of the 4, and the rest is similar to your own calculation.
Upgrade your Qlik skills at the Masters Summit for Qlik - coming soon to Munich, Germany!
You have a great memory, the syntax was right on.
However, I was not able to quite get the result I was after.
I'm attaching a sample file, I would appreciate it if you can take a peek?
I've attached both a sample app and data for your consideration.
Once I remove the date from my dimension, things start to fall apart (& it kind of makes sense).
May be this:
FirstSortedValue(DISTINCT Aggr(avg(aggr(NODISTINCT rangeavg(below(min(price), 0, 4) ), date)), date, rep, product, level), -Aggr(date, date, rep, product, level))
sample data.qvw 166.2 K
May be this expression:
=FirstSortedValue(Aggr(If(date*10000 + result >= Max(Total <fixture> date*10000 + result, 4), result), fixture, date, result), Aggr(date*10000 + result, fixture, date, result))
243859.qvw 154.8 K