Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Aggregation function for Last Year values

Hi everyone.

I am currently having a problem trying to get my statement for Last Year values to work. I want to obtain the Cost Value for my Last Year data. It works just fine with this equation:

(Sum(FOODCOST*Sum({<CalendarYear = {$(=Max(CalendarYear)-1)}>}QUANTITY))

+ Sum(ComboFC*Sum({<CalendarYear = {$(=Max(CalendarYear)-1)}>}ComboQty)))/1000

but when I adopt it to a pivot table and use it for other fields like % to Sales, I realized I had to have an aggregated function for the groupings. So I came up with this equation:

(Sum(aggr(FOODCOST*Sum({<CalendarYear = {$(=Max(CalendarYear)-1)}>}QUANTITY), PRODUCTDESC, BRANCHNAME, COST1))

+ Sum(aggr(ComboFC*Sum({<CalendarYear = {$(=Max(CalendarYear)-1)}>}ComboQty), COMBOPRODDESC, BRANCHNAME, COST1)))/1000

*Where COST1 is my Inline Table for Dimensions of the pivot table

but the resulting value is lacking by at least 2000 (in P(000)) from my target result. Any ideas?

0 Replies