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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Average?

Hi everyone,

Please help me with another formula for the average

avg.png

I try this:

sum(value)/count(distinct monthyear)

But, It ignores zeros months.

Best regards,

Rodrigo

8 Replies
settu_periasamy
Master III
Master III

Hi,

Did you try without distinct..

Sum(value)/count(monthyear)

or

Avg(value)

Not applicable
Author

Hi,

I try without distinct, but I need the monthly average and the result is different from average y with con Avg(value) neither.

I need a function to count the months that are in the table and consider the zeros

Thank you,

sunny_talwar

Not sure I understand, 16.25 seems like correct average where your Sum(Value) = 130 and Count (monthyear) = 8 and 130/8 = 16.25. What are you expecting to see?

Not applicable
Author

Hi,

When I have the function count(monthyear) the result is not equal to 8 and when I have the function count (distinct monthYear) is not the result 8, so the do with that very long expression.

avg2.png

Best regards,

Rodrigo

sunny_talwar

Try this may be:

Max(TOTAL Aggr(Count(DISTINCT monthyear), Item))

jonathandienst
Partner - Champion III
Partner - Champion III

It will not count months that are missing (ie no entries containing that month). You will need to populate a master calendar with the missing months. This might help:

How to populate a sparsely populated field

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Thank you very much Sunnny

sunny_talwar

Not a problem. I am glad it helped.

Best,

Sunny