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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
chan103148
Contributor III
Contributor III

disregaring zero or null values in computing average

good day,

 

need help

this is my data:

DATETraffic
1/1/2020329
1/2/2020346
1/3/2020324
1/4/2020363
1/5/2020347
1/6/2020239
1/7/2020209
1/8/2020201
1/9/2020213
1/10/2020254
1/11/2020399
1/12/2020395
1/13/2020159
1/14/2020222
1/15/20200
1/16/20200
1/17/20200
1/18/20200
1/19/2020353
1/20/2020158
1/21/2020201
1/22/2020218
1/23/2020183
1/24/2020244
1/25/2020303
1/26/2020348

 

Qlik sense is computing average traffic with those dates with zero count which gives me 231 average traffic, I want to disregard those dates without a traffic count to get more reliable average traffic.

 

here is my script:

avg(Aggr(Sum({$<[DATE.autoCalendar.YearMonth]={"2020-Jan"}>}[Traffic In]),[DATE],[$STORE]))

 

thank you

 

Labels (1)
1 Solution

Accepted Solutions
Mauritz_SA
Partner - Specialist
Partner - Specialist

Hi there

You can do this by adding that condition in your set analysis:

avg(Aggr(Sum({$<[DATE.autoCalendar.YearMonth]={"2020-Jan"},Traffic={">0"}>}[Traffic In]),[DATE],[$STORE]))

Hope this helps.

Regards,

Mauritz

View solution in original post

1 Reply
Mauritz_SA
Partner - Specialist
Partner - Specialist

Hi there

You can do this by adding that condition in your set analysis:

avg(Aggr(Sum({$<[DATE.autoCalendar.YearMonth]={"2020-Jan"},Traffic={">0"}>}[Traffic In]),[DATE],[$STORE]))

Hope this helps.

Regards,

Mauritz