Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
makrishnaraj
New Contributor III

Average for a week based on selected date

Hi,

I need to calculate the Average for the 5 days say for example in the below table. If i select Report Date as 25/09/2015 then my average should display as  11.4 in the text box i.e. avg of 21/09/2015 to 25/09/2015.

 

IDReportDateSum(CallsAnswered)
1065821/09/20158
1065822/09/20159
1065823/09/201514
1065824/09/201514
1065825/09/201512

Thanks in advance.

Regards,

Krishna

1 Solution

Accepted Solutions
makrishnaraj
New Contributor III

Re: Average for a week based on selected date

Hi Balraj,

Thanks for you help.

I used the below formula & it worked for me.

=(Sum({<ReportDate={">=$(=date(max(ReportDate)-5))<=$(=date(max(ReportDate)))"}>} CallsAnswered))/5

6 Replies
balrajahlawat
Esteemed Contributor

Re: Average for a week based on selected date

you can try sth like:

=avg({<ReportDate={'>=$(=date(max(YourDateField)-5,'DD/MM/YYYY')

<=$(=date(max(YourDateField),'DD/MM/YYYY')>} CallAnswered)

Hope this will help!!

makrishnaraj
New Contributor III

Re: Average for a week based on selected date

Hi Balraj,

Thanks for you Information, as you have mentioned max(YourDateField),  the DateField is also a ReportDate.

balrajahlawat
Esteemed Contributor

Re: Average for a week based on selected date

okay, simply try:

=avg({<ReportDate={'>=$(=date(max(ReportDate)-5,'DD/MM/YYYY')

<=$(=date(max(ReportDate),'DD/MM/YYYY')>} CallAnswered)

Not applicable

Re: Average for a week based on selected date

Hi,

try this:

makrishnaraj
New Contributor III

Re: Average for a week based on selected date

Hi Balraj,

Thanks for you help.

I used the below formula & it worked for me.

=(Sum({<ReportDate={">=$(=date(max(ReportDate)-5))<=$(=date(max(ReportDate)))"}>} CallsAnswered))/5

HirisH_V7
Honored Contributor

Re: Average for a week based on selected date

Hi,

Check out the attachment .

I hope that helps.

Regards,

Hirish7days.PNG

HirisH
“Aspire to Inspire before we Expire!”