Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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

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

talk is cheap, supply exceeds demand

View solution in original post

1 Reply
Gysbert_Wassenaar

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

talk is cheap, supply exceeds demand