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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Average expressions

hi ,

I have to calculate average for selected number of zones. If i select single zone it will display the correct value, but if i select two to three zones , it is not showing the correct value. Please help me with the expressions.

Thanks in advance

Labels (1)
4 Replies
swuehl
Champion III
Champion III

It is hard to answer your request, because we don't know anything about the expression you are using, the data model, the context.

Could you post a small qvw sample file here to the forum? And your requested result?

Or some lines of your data as INLINE table?

Not applicable
Author

 

"Avg

({$< Year = {"<=$(#vYear)"}>}[ Annual Average]) "

where annual average values are  -28.91  -28.27 & 25.48

Answer should be -10.56 . But it is displaying -16.

swuehl
Champion III
Champion III

Have you checked the number of records that avg() uses, i.e. the frequency of your [Annual Average] values?

Try using

count({$< Year = {"<=$(#vYear)"}>}[ Annual Average])

Do you get 3 for your sample?

Not applicable
Author

Yes i did. I checked the frequency, Its more .

I used DISTINCT in the same expression & got correct answer. Thanks for your clue