Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with 'Aggr' function and chart

Hello all,

I have a chart with a 'aggr' function to calculate a share of a product in a certain category ;

2011-07-15 14.0601.gif

(selection Month=12)

For 'Share in Category' I use the function;

Sum (Value) / aggr(NODISTINCT sum(Value),Category)

Now I want a chart with on the dimension the months, this looks like this

2011-07-15 14.1202.gif

So far all works fine! See the value for month 12 in this table en the value in the first table! Now I want to add the share;

2011-07-15 14.1403.gif

As you see i do not get the right value for share, the problem is the second part of the function;

aggr(NODISTINCT sum(Value),Category)

This one doesn't work right in the the last table, but when I select only one month in the table, it works fine again??!!;

2011-07-15 14.1704.gif

Can anyone help me out here?? Thanks in advance!!

I attached an example!

1 Solution

Accepted Solutions
Not applicable
Author

Found the solution!;

aggr(NODISTINCT sum({<Product=>}If(InYearToDate(Date#(DateKey,'DD-MM-YYYY'),Date#('01'&'-'&CHART_Month&'-'&$(=PIT_Year),'DD-MM-YYYY'),0), Amount)),Category, CHART_Month)

The problem is that the aggr functions doesn't look to the dimension

View solution in original post

3 Replies
hugo_andrade
Partner - Creator II
Partner - Creator II

Good Day, Try to use Group By at the script

Not applicable
Author

Can you give me an example please?

Not applicable
Author

Found the solution!;

aggr(NODISTINCT sum({<Product=>}If(InYearToDate(Date#(DateKey,'DD-MM-YYYY'),Date#('01'&'-'&CHART_Month&'-'&$(=PIT_Year),'DD-MM-YYYY'),0), Amount)),Category, CHART_Month)

The problem is that the aggr functions doesn't look to the dimension