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: 
aronvermeulen
Contributor III
Contributor III

Aggr result changes when I make selection date

 

The aggr function is working correct when i do not have a selection:

aronvermeulen_1-1587022600707.png

 

But when I make a selection the result is changing, I really don't understand why.

I would say the dimension is not changing, so the aggr shouldn't do either.

aronvermeulen_2-1587022659654.png

aronvermeulen_0-1587022546113.png

 

I can make a workaround by making the average per container in the script. 

But I would like to learn what I do wrong in this case.

4 Replies
lironbaram
Partner - Master III
Partner - Master III

when using 

aggr functions in a chart you need to include the chart\table dimension in the function 

to get the right results 

in your case you need to add your month dimension 

aronvermeulen
Contributor III
Contributor III
Author

Thanks for your reply.

I already tried like below. But maybe this is not working because the used Month() and year() functions?

aronvermeulen_0-1587029879540.png

I rebuild it to Month (Maand) and year (Jaar).

But now the result is not correct, 2020-04 should be 2.7, not 36.

aronvermeulen_1-1587030413529.png

Can you tell me with this information what I am doing wrong?

 

 

 

lironbaram
Partner - Master III
Partner - Master III

hi 

it's hard 

can you share sample data , so i can understand the fields and the tables structure 

it can be 2-3 rows from each table , i'll put more demo data to the structure 

marcus_sommer

Without knowing the datamodel it's difficult to say what's different to your expectation. In each case you shouldn't use such a calculated dimension neither in general nor by applying an aggr(). Just define all needed period-fields within the calendar and this means also the combination of year and month within an extra field and then use this field also within the aggr().

- Marcus