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: 
TomBond77
Specialist
Specialist

calculate average for values > 0

Hi experts

This formula works fine:

avg( ([Entry Date (CPUDT)] - [Posting date]))

This formula not:

avg( ([Entry Date (CPUDT)] - [Posting date])-={'0'})

Any ideas how to solve this issue?

Thank you, Tom

Labels (4)
1 Solution

Accepted Solutions
MarcoWedel
MVP
MVP

maybe like 

Avg(If([Entry Date (CPUDT)]<>[Posting date],[Entry Date (CPUDT)] - [Posting date]))

or using some key field and set expression instead of the If() function:

Avg({$<Key={"=[Entry Date (CPUDT)]<>[Posting date]"}>} [Entry Date (CPUDT)] - [Posting date])

View solution in original post

1 Reply
MarcoWedel
MVP
MVP

maybe like 

Avg(If([Entry Date (CPUDT)]<>[Posting date],[Entry Date (CPUDT)] - [Posting date]))

or using some key field and set expression instead of the If() function:

Avg({$<Key={"=[Entry Date (CPUDT)]<>[Posting date]"}>} [Entry Date (CPUDT)] - [Posting date])