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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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