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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

Help with aggregating an expression

Hi All.

I have the following expression

sum(aggr($(vAnnualSalesv2),SubCat,SubCat1,[Item Description]))

which is made up of the following

$(vAvgPrice)*$(vForecastSales)+$(vTotalSalestoLastPeriod)

I thought it was working but noticed that the results were lower than expected. On investigation i found that some rows of data were not being included because they didn't have a 'ForecastSales' value (as they have been discontinued).

i have therefore changed the expression to the following..

if(isnull($(vForecastSales)),$(vTotalSalestoLastPeriod),sum(aggr($(vAnnualSales),SubCat,SubCat1,[Item Description])))

this populates a straight table correctly when i am drilling down to 'Product' level, but it doesnt aggregate properley when going back up the drill down.

as you can see, the total for the 3 lines add correctly..

Capture.PNG

but when going back up yoiu can see that it shows a different value (highlighted - its missing the 7,102.08)

Capture.PNG

Can anyone see what i am doing wrong?

thanks, example attached

10 Replies
sunny_talwar

Sure