Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
JulesVerne
Contributor II
Contributor II

Average calculation with "Zero" valued months

Dear Friends,

I have a table about product sales. (StockCode, SalesDate, SalesAmount)

SalesSales

 

 

 

And I want to get this table :

Average ChartAverage Chart

 

Average-1 : Divided By Count(MonthName)

Average-2 : Divided By Count(Has Value MonthName)

Could you help me please..

Regards

 

Labels (1)
1 Reply
edwin
Master II
Master II

the answer will depend on more detail that you can give.  assumptions can be made, since you wanted the average with 0 sales - this means there has to be a row for the month where sales=0.  

if you specify an expression avg(x), 0 values will be included automatically - Average 1; if you dont want the 0 values included add set analysis to exclude them avg({<x={"<>0"}>}x) here is a sample:

edwin_0-1685735824493.png