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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis max date

Good day

There is a need to calculate the stock at the end of the month

Table_stock:

GoodsDate
Stock_qty
103.11.122
110.11.124
120.11.122
102.12.1254
106.12.123

Calendar table:

DateMonthWeek
01.11.12November34
.........
06.12.12December40

Pivot Table

GoodsMonthStock qty
1november2
1December3

I tried a set analysis and if

Sum({<Date={'$(=Max(Date))'}>} Stock)

Aggr(Sum({<Date={'$(=Max(Date))'}>} Stock),Goods,Month)

Sum({<Date={'$(=Aggr(Max(Date),Month))'}>} Stock)

Sum(if(Date=Max(Total Date),Stock))

3 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Try with FirstSortedValue functionality

=FirstSortedValue(Stock, -num(Date))

Hope it helps

Not applicable
Author

Thanks for the answer, but it does not work for me

marcelo_7
Creator
Creator

This solved my similar problem! Thanks!