Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

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

- Qlik Community
- :
- Forums
- :
- Analytics
- :
- New to Qlik Sense
- :
- Re: How to plot complicated Aggr expression?

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

hh2019

Contributor II

2019-05-16
04:53 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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

- Tags:
- aggr()

241 Views

1 Solution

Accepted Solutions

rogerpegler

Creator II

2019-05-16
07:00 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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))

228 Views

1 Reply

rogerpegler

Creator II

2019-05-16
07:00 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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))

229 Views