Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello. I want to show gross sales only for 2011 year by using sum, if and aggr. Can someone tell me why is this function wrong and write down the correct function? Why I need at least two parameters for aggr? I am new user and would very appreciate help.
"Gross sales" is measure, not field.
Thanks!
Thank you for help. Unfortunately, function does not work. It says there is error in expresion. Meanwile, i came up with new function which, luckily, works.
sum({$<[OrderDate.autoCalendar.Year] = {2011} >} [Order details.UnitPrice]*Quantity)
Thank you for your time and effort.
BR, Matej
The aggr() function calculates an expression over a specified dimension. So your first parameter should be the expression you are trying to calculate, and the second (and potentially third, fourth, etc.) parameter should be the dimension(s) you are trying to calculate the expression over.
In the function you have, you say Gross Sales is your measure, so you need to put in dimension(s) to calculate the expression over.
https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/aggr.htm
@kralj_matej Why can't you use a set analysis to get the desired output. As per my Understanding if you need to find the Sum of Gross Sales just for 2011. It could be something like below. Let me know if it has helped you.
Sum({<[OrderDate.autocalendar.Year]={'2011'}>}[Gross Sales])
Thank you for advice. I found a solution.
Thank you for help. Unfortunately, function does not work. It says there is error in expresion. Meanwile, i came up with new function which, luckily, works.
sum({$<[OrderDate.autoCalendar.Year] = {2011} >} [Order details.UnitPrice]*Quantity)
Thank you for your time and effort.
BR, Matej
testing