Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Welcome to Qlik Community! Check out our new navigation! FIND OUT MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
hh2019
Contributor II
Contributor II

How to plot complicated Aggr expression?

Hello,

I have the following Aggr expressions that calculate an indicator relevant to my business

 

Aggr(Sum(Aggr(max(Aggr(if(
XCOUNT=0 AND Y>3000000 AND TYPE='A' AND ZCOUNT=1,
1,0),ID,MONTHNUMBER,NAME)),ID_3,MONTHNUMBER)),NAME)
+
(3*
Aggr(Sum(Aggr(max(Aggr(if(
XCOUNT=1 AND Y>3000000 AND TYPE='A' AND ZCOUNT=1,
1,0),ID,MONTHNUMBER,NAME)),ID_3,MONTHNUMBER)),NAME)
)
+
(4*
Aggr(Sum(Aggr(max(Aggr(if(
XCOUNT=2 AND Y>3000000 AND TYPE='A' AND ZCOUNT=1,
1,0),ID,MONTHNUMBER,NAME)),ID_3,MONTHNUMBER)),NAME)
)
+
(5*
Aggr(Sum(Aggr(max(Aggr(if(
XCOUNT=3 AND Y>3000000 AND TYPE='A' AND ZCOUNT=1,
1,0),ID_2,MONTHNUMBER,NAME)),ID_3,MONTHNUMBER)),NAME)
)
+
(2*(sum(if(Aggr(max({<  TYPE={'A'} >} Y),ID_3,MONTHNUMBER)>25000000,1,0))))

+
SUM(Aggr(if(
TYPE='P' AND (Date#(VCT_MAX, 'YYYYMMDD')-Date#(CON, 'YYYYMMDD'))>30 AND Y>=3000000 AND AGGR(COUNT(ID_2),ID_3)>=1,
-1,0),ID,MONTHNUMBER,R))

 

I am trying to plot it by MONTHNUMBER or by R and having no luck.

Could you guys please point me in the right direction?

Thank you!

HH

Labels (2)
1 Solution

Accepted Solutions
rogerpegler
Creator II
Creator II

I think your dimension (MONTHNUMBER ) needs to be an element of the aggr at the highest level. I've also found it needs to be applied at each component.  For example if I have an expression being 

sum(aggr(numerator_expression,field))
/
sum(aggr(denominator_expression,field))

To get that to plot across a dimension field DIM, you would have

sum(aggr(numerator_expression,field,DIM))
/
sum(aggr(denominator_expression,field,DIM))

Having DIM as part of an aggr inside inside expressions (eg numerator_expression) is not enough, and the format below won't work

sum(aggr(

sum(aggr(numerator_expression,field))
/
sum(aggr(denominator_expression,field))

,DIM))

 

 

 

View solution in original post

1 Reply
rogerpegler
Creator II
Creator II

I think your dimension (MONTHNUMBER ) needs to be an element of the aggr at the highest level. I've also found it needs to be applied at each component.  For example if I have an expression being 

sum(aggr(numerator_expression,field))
/
sum(aggr(denominator_expression,field))

To get that to plot across a dimension field DIM, you would have

sum(aggr(numerator_expression,field,DIM))
/
sum(aggr(denominator_expression,field,DIM))

Having DIM as part of an aggr inside inside expressions (eg numerator_expression) is not enough, and the format below won't work

sum(aggr(

sum(aggr(numerator_expression,field))
/
sum(aggr(denominator_expression,field))

,DIM))