Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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 (1)
2 Solutions

Accepted Solutions
agigliotti
Partner - Champion
Partner - Champion

Try with this one:

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

View solution in original post

agigliotti
Partner - Champion
Partner - Champion

the * means all field values except null.

View solution in original post

3 Replies
agigliotti
Partner - Champion
Partner - Champion

Try with this one:

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

QFanatic
Creator
Creator
Author

Hello

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

Thank you
agigliotti
Partner - Champion
Partner - Champion

the * means all field values except null.