# Qlik Sense App Development

Highlighted
New Contributor III

## Week day year Average

Hello everyone,

I have the following tables:

Sales:

ID,
Shop,
Category,
Date,
Sales;

Calendar:

Date,
WeekDay,
NrWeek;

What I need to get is an average per week day of the whole year.

In the app I've created a table to check everyday if some sales are missing from the dataset:

Aside I created another table where I would like to have the average per week day:

AvgSales = Avg(Aggr(Sum(Sales),WeekDay)

As you can see this is not the average but the sum.

What can I do to get the average?

Labels (3)

10 Replies
Contributor II

## Re: Week day year Average

Hi, Luca

try this
AvgSales = Avg(Aggr(Sum(Sales),Date)

ZZ
New Contributor III

## Re: Week day year Average

It doesn't work.

Valued Contributor

## Re: Week day year Average

Hi Luca,

Perhaps I'm missing something, but if you only display the WeekDay and Sales in the table, all you need is to us Avg(Sales), no need for the Aggr() function.

New Contributor III

## Re: Week day year Average

Hi Rbartley,

the problem is that the db has sales for every category of every shop in everyday, so if I do a simple average it shows the average of category per day:

What I need is the total average for eache  weekday.

Valued Contributor

## Re: Week day year Average

Ok, could you please post your app (remove of obfuscate any sensitive data if necessary)?  You will need to zip it in order to post it as there is a bug on the Qlik Community site that prevents one from uploading the qvf files.

Valued Contributor

## Re: Week day year Average

Take a look at the attached app (you'll have to unzip it).  I've included category in the data and if I use Avg(Sales) with just WeekDay in the table, the formula still works since Qlik Sense calculates it on the context of the dimensions in the table.  I've also added another table which also includes category and in which I've used the formula: Aggr(Avg(Sales),WeekDay).  This shows the same average figures too.

New Contributor III

## Re: Week day year Average

Here you can find my app.

Valued Contributor