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

Problem with Totals using FirstSortedValue and aggr

Hi Gurus,

I'm trying to create a pivot table: Dimensions: WARH (warehouse), IDPROD, (product) and DATEINV (date inventory) , period (master dimension year, month, day).

Expression, Stock at the end of Year, Month, Day: FirstSortedValue(DISTINCT Aggr(sum(QTY), IDPROD,DATEINV) , -DATEINV)

Details are OK but the total is not correct:

Year

CaseFirstSortedMonth.jpg

Month

CaseFirstSortedYear.jpg

Day

CaseFirstSortedDay.jpg

Thanks in advance,

Juan

1 Reply
sunny_talwar

May be this:

Sum(Aggr(FirstSortedValue(DISTINCT Aggr(sum(QTY), IDPROD,DATEINV) , -DATEINV), WARH, IDPROD, DayInv))


Capture.PNG