Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
ahmedwank
Contributor III
Contributor III

average by considering empty field as zero

hi all

i am trying to calculate a basic average by date but i need to consider the empty field as zero i the average.

let's imagine we have the distinct date from 01/01/2019 --> 10/01/2019

exemple :

daterefqty ordered
01/01/2019A10
02/01/2019A20

 

The average for the ref A should be (10+20)/10 (= distinct dates) = 3

but when i used avg(aggr(sum(Qty),ref,Date)) i only see an average without considering the date where we have 0 qty 

thanks a lot in advance!

 

 

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try: sum(Qty)/count(distinct Date)

talk is cheap, supply exceeds demand

View solution in original post

1 Reply
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try: sum(Qty)/count(distinct Date)

talk is cheap, supply exceeds demand