Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

bharatkishore
Contributor III

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


Can you please help me how can i achieve this.


Attached qvw for reference.


Thanks

Bharat

1 Solution

Accepted Solutions

Re: Need to calculate avg based on selection filter

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

7 Replies
qliksus
Valued Contributor

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)

bharatkishore
Contributor III

Re: Need to calculate avg based on selection filter

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

bharatkishore
Contributor III

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?

bharatkishore
Contributor III

Re: Need to calculate avg based on selection filter

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

bharatkishore
Contributor III

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

Community Browser