5 Replies Latest reply: Oct 7, 2013 8:37 AM by Celambarasan Adhimulam

# Max(Aggr()) facing problem

I am trying to find the max visits value from a trend chart for visits.

I am using the following expression :

=Max(Aggr(Sum({<Date={">=\$(PrevMonth_2)<=\$(=Date(Max(Date)))"}, Quarter=, [Ref]={'All'}>}Visits)/1000000,Date))

Here, PrevMonth_2 is a variable that points to the six months
prior to the current selected month i.e. start month of the trend.

Ref={‘All’} condition is used so that I get all the visits for ‘all’ the referrals.

Date is the variable that I have named for months.

The above expression returns me only the visits for the latest selected Month (variable Date) i.e. the last data point of the trend.

Kindly help me to resolve it. It is quite urgent.

Thanks

• ###### Re: Max(Aggr()) facing problem

Hi,

PFA  and modify your sample application expression or post you sample application

• ###### Re: Max(Aggr()) facing problem

You should try something like this

=Max({<Date={">=\$(PrevMonth_2)<=\$(=Date(Max(Date)))"}, Quarter=, [Ref]={'All'}>} Aggr(Sum({<Date={">=\$(PrevMonth_2)<=\$(=Date(Max(Date)))"}, Quarter=, [Ref]={'All'}>}Visits)/1000000,Date))

• ###### Re: Max(Aggr()) facing problem

Thanks a lot. Its working fine now.

• ###### Re: Max(Aggr()) facing problem

celambarasan Thanks for your solution. Can you please also explain me why the expression that was used by me was not correct?
I have used similar expression in other applicatoins and they are working fine.

• ###### Re: Max(Aggr()) facing problem

Hi,

I don't know what you have done in other applications.

But here your excluding the selections in Sum which is inside aggr.

If you apply simply max function for around the Aggr then it will take the Maximum value for the selection alone.

You have to use the same set analysis outside the Aggr.