Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calculating average of values of n periods

Hello,

i want to calculate the average of actual sales of products. The problem that the number of period changes from a product to another beacause it depends on its launch period. To explain more we take for example a product A, it is a new product and it was launched two months ago and a product B that has more values because it is older than the product A.

So i have products and their sales per month and i want to calculate the sales average.

Thank you,

Alâa Eddine.

12 Replies
olivierrobin
Specialist III
Specialist III

hello

maybe something like

load product,sum(sales)/count(distinct month) as average

group by product

Anonymous
Not applicable
Author

Hello,

thank you but it does not work.

olivierrobin
Specialist III
Specialist III

what does it mean ?

no result ? wrong result ?

can you post your code ?

Anonymous
Not applicable
Author

Hello,

this is what i have as datas.

I want to add a column to calculate the average for each SalesAggregatedBrand.

Capture.PNG

Anonymous
Not applicable
Author

Hello,

you can notice here that for the product "ADVANCE" there is only five periods available so the average will be the sum of Actual Sales divided by 5 and for the product ANATEO i have to devide the sum of actual sales   by 15 because we have 15 periods.

How can I do that?

Thank you,

Alâa Eddine

olivierrobin
Specialist III
Specialist III

and what about

sum(Sales)/count(distinct YearMonth)

Anonymous
Not applicable
Author

Hello,

i noticed that he devided the sale volume by 60 for all the products and for all periods.

Any ideas, please?

olivierrobin
Specialist III
Specialist III

did you use it as expression in your graph ?

Anonymous
Not applicable
Author

Hello,

i show you where i used.

Expression.PNG

volatility.PNGsa.PNG