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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate the average with missing data

Hi all,

I have a dataset which only stores monthly sales of materials when actual sales have occured.

When calculating the average, Qlikview doesn't take the months without sales into account.

I'm looking for a solution to calculate the average correct without adding extra records for the months without sales.

Here is screenshot of the situation:

error loading image

The average sales based on the 4 months should be 87,5. Now Qlikview is only considering months 1-3.

Do you have any ideas? Thanks.

James.

4 Replies
amit_shetty78
Creator II
Creator II

Hi James,

Please try the following expression instead of AVG(Sales).

=sum(Sales)/count(TOTAL Month)


Rgds,

Not applicable
Author

Hi Amit,

When selection is made on material 1, then average is still not correct.

See screenshot:

Kind regards,

James.

amit_shetty78
Creator II
Creator II

Hi James,

This is because Material 1 is not associated to month 4. You would have noticed that when Material 1 was explicitly selected '4' was excluded from the month's selection making the count of months to 3.

One suggestion could be that instead of keeping the sales value in month 4 blank, you can put in sales value as 0 for Material 1 in the 4th Month.

Hope this helps.

Rgds, Amit.

Not applicable
Author


Hi Amit,

In order to keep the number of records as small as possible, I don't want to add records with zero sales as I mentioned before.

Kind regards,

James.