Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
I have the following tables:
Sales:
LOAD
ID,
Shop,
Category,
Date,
Sales;
Calendar:
LOAD
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?
Thanks in advance.
It doesn't work.
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.
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.
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.
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.
Here you can find my app.
How about this?
=Aggr(Sum(Sales),WeekDay)/Count(WeekDay)
No, the correct result should be this: