Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
NavinReddy
Creator II

Aggr()

Hi All,

Could some one help me

What is the purpose of AGGR and How it helps

Thanks In Advance

Niranjan

1 Solution

Accepted Solutions
Not applicable

Hi Niranjan,

Aggr() function is used to combine two aggregation functions.

syntax: aggr(expression, dimension)

It is used to making a temporary table in between two aggregation functions

ex. min(aggr(max(value),customer))

table is like this:

customer      value

A                 20

A                 30

B                 10

B                  15

C                  40

here aggr(max(Value),Customer) function making a temporary table like this:

customer    value

A               30

B               15

C               40

then min() function retrieves the record B   15 from the temp table

I think now you understood the concept of aggr() function

Regards,

Nuthan

View solution in original post

12 Replies
VishalWaghole
Specialist II

Hi Niranjan,

Aggr() is same like group by clause in SQL.

- Regards,

Vishal Waghole

Anonymous
Not applicable

Hi Niranjan,

AGGR() is advanced aggregation function that can be used to aggregate a other aggregate function.

Example...

You have country , customer, sales in your table,

If you provide country , customer as dimension and sum(sales) as expression in chart,

then sum() will aggregate sales on basis of country and customer,

while if you use another expression aggr(sum(sales),country), it  will return aggregated sales based on country only.

One more thing , by using aggr(), you can even use your expression as dimension....

Hope this helps..

Regards

Nitin

Anonymous
Not applicable

AirlinePlane# of Passengers
Delta747

10

Delta73720
United Airlines74710
United Airlines73720

In the above table the average # of passengers is 15  (60/4) but what if I wanted to find out the average # of passengers by Airline only.

To do so I can aggregate the table without doing it in the script by using the aggregation function.  When I type the function "Aggr( sum( [# of Passengers]), Airline)"  the result would look like the below table in theory.  So now when I do an average "Avg( aggr( sum( [# of Passengers]), Airlne))" I get the result of 30  (60/2).

Airline# of Passengers
Delta

30

United Airlines30
Not applicable

Hi Micheal,

How to achieve this in a table. I have 2 fields 'Airline' and '# OF Passengers" and i want the sum of passengers across every unique Airline. How to achieve this in a table?

Anonymous
Not applicable

just take airline in dimension and sum(passengers) as expression...

Or if you want in script, then

Load distinct Airline,

sum(passenger) as passengers

from table name

group by airline;

will give your desired result...

Regards

Nitin

Not applicable

Hi Nitin,

that works in case of a chart which i am well aware of. But where to write an expression in case of a table?

Anonymous
Not applicable

What do you mean by table>>

Table box or Straight table.

For table box you have to use calculation in script level only.

as mentioned in my previous comment.

and for straight table you can write expression as you know ...

Regards

Nitin

Not applicable

Hi Niranjan,

Aggr() function is used to combine two aggregation functions.

syntax: aggr(expression, dimension)

It is used to making a temporary table in between two aggregation functions

ex. min(aggr(max(value),customer))

table is like this:

customer      value

A                 20

A                 30

B                 10

B                  15

C                  40

here aggr(max(Value),Customer) function making a temporary table like this:

customer    value

A               30

B               15

C               40

then min() function retrieves the record B   15 from the temp table

I think now you understood the concept of aggr() function

Regards,

Nuthan