# App Development

Announcements
NEW webinar Dec. 7th: 2023 Outlook, A Pivotal Year for Data Integration SIGN ME UP!
cancel
Showing results for
Did you mean:
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)

• ### weekday

10 Replies
Creator II
Hi, Luca

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

ZZ
Contributor III
Author

It doesn't work.

Specialist II

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.

Contributor III
Author

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.

Specialist II

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.

Specialist II

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.

Contributor III
Author

Here you can find my app.

Specialist II

=Aggr(Sum(Sales),WeekDay)/Count(WeekDay)

Contributor III
Author

No, the correct result should be this:

Tags
Community Browser