7 Replies Latest reply: Aug 8, 2016 12:07 PM by Sunny Talwar

# Need to calculate avg based on selection filter

Hi All,

I am using an pivo table chart and i am using it to display average of last 3 weeks. As of now the last 3 weeks is coming exactly.

But now my problem is i need to take an week filter and what ever week they selects in the multi box based on that particular week the average of last 3 weeks should come.

For example i have data like

10/5/2015

10/12/2015

10/19/2015

10/26/2015

11/2/2015

11/9/2015

11/16/2015

Now if  select 10/26/2015 the avg should come for 10/26.10/19,10/12

if i select 11/16/2015 the avg should come for 11/16/2015,11/9/2015,11/2/2015

Attached qvw for reference.

Thanks

Bharat

• ###### Re: Need to calculate avg based on selection filter

Hi

As you have already defined the Last 3 weeks logic in the backend  use the below set analysis to get the result

(sum({<Week={">=\$(=date(min(WeekKey)))<=\$(=date(max(WeekKey)))"}>}Opt_Spend)/sum({<Week={">=\$(=date(min(WeekKey)))<=\$(=date(max(WeekKey)))"}>}Opt_Impressions)*1000)

• ###### Re: Need to calculate avg based on selection filter

Thanks Susant. Will try and let you know.. thank you...

• ###### Re: Need to calculate avg based on selection filter

Hi Susant,

I have tried but it isn't working..

• ###### Re: Need to calculate avg based on selection filter

Can you check if attached looks like what you are looking for?

• ###### Re: Need to calculate avg based on selection filter

Thanks Sunny.. But i figured the solution....Thanks a lot for ur help...

• ###### Re: Need to calculate avg based on selection filter

But your solution also helped me....Thanks...

• ###### Re: Need to calculate avg based on selection filter

No problem at all