Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
ArriesWE
Contributor
Contributor

Get previous result base on user selections

Hi Everyone,

I would like to look at previous activity/results when a user selects any date. Example, if I selected the date 2020/11/13 where the result is -11, I would like the second result to be the one that occurred before that, on the 2020/10/26, which was -7

The script below works, but not in the way that I want. I would like the second result ONLY to be the first activity that occurred, not all the data running back for a couple of weeks…

sum(aggr(
If(Only({<TRAN_DATE=>}TRAN_DATE)=Max({<TRAN_DATE=>}TOTAL <ITEM_LONG_DESC>
If(isnull(GetFieldSelections(DAY_AND_DATE)),
TRAN_DATE,
If(TRAN_DATE < GetFieldSelections(DAY_AND_DATE),TRAN_DATE))),Sum({<TRAN_DATE=>} PHYSICAL_COUNT_QTY),Null())
,ITEM_LONG_DESC, TRAN_DATE))

Kind regards,

Wesley

Labels (1)
0 Replies