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

Announcements
Posting on Qlik Community is temporarily paused. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
QFanatic
Creator
Creator

Assist with Average Calculation - exclude some values

Hi guys

Hoping this will be quick and simple, LOL!

 

I am calculating an average in a chart -  to Average out an Hour_Volume over Weekday(WKDAY) and REQ_HOUR.

REQ_HOUR, for a normal day will contain values from 00 to 23 (count - 24 hours in the day)

Sometimes, though, my REQ_HOUR returns a null value (problem in the underlying data) - so then I have hard-coded REQ_HOUR = 'NULL'.

The problem comes in, in the Average Calc - when there are 24 REQ_HOURS - the Average statement works fine.

However, when there are 25 hours (the 'NULL' included) the Average works incorrectly (that is to be expected)

Now, in the original statement I have at the BOTTOM of this post..how do I EXCLUDE where REQ_HOUR = 'NULL' in the TOTAL statement? so that the calculation is done correctly? 

Much appreciation.

 

avg({$<PERIOD={$(vMaxMonth)},REQ_DATE=, TYPE_GRAPH = {'HOURLY'}, REQ_HOUR -= {'NULL'}>}total <WKDAY,REQ_HOUR> HOUR_VOLUME)

Labels (2)
2 Solutions

Accepted Solutions
agigliotti
MVP
MVP

Try with this one:

avg({$<PERIOD={$(vMaxMonth)},REQ_DATE=, TYPE_GRAPH = {'HOURLY'}, REQ_HOUR = {"*"} >} total <WKDAY,REQ_HOUR> HOUR_VOLUME)

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it

View solution in original post

agigliotti
MVP
MVP

the * means all field values except null.

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it

View solution in original post

3 Replies
agigliotti
MVP
MVP

Try with this one:

avg({$<PERIOD={$(vMaxMonth)},REQ_DATE=, TYPE_GRAPH = {'HOURLY'}, REQ_HOUR = {"*"} >} total <WKDAY,REQ_HOUR> HOUR_VOLUME)

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
QFanatic
Creator
Creator
Author

Hello

I will definitely try. What does the * mean in this context?

Thank you
agigliotti
MVP
MVP

the * means all field values except null.

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it