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: 
aendr3w
Contributor III
Contributor III

Problem with zero values using RangeAvg

Hello!

I'm doing a year over year line chart comparison with sales numbers for each work day, plus daily budget. And to smooth out the curves i wish to average the sales numbers over the 10 last work days. However, since the holidays don't accur on the same day every year i get some zero values that are included in the RangeAvg. To demonstrate this more clearly i've made a table and set the Rangeavg to 2.

the current code is :

rangeavg(above(sum({1<[Date of Entry (Year)] ={$(vActualYear)} [# Net Amount Order]-={'0'}>}[# Net Amount Order]),0,2))

I'm using weekNumber/weekday as dimension to exclude saturdays and sundays. But i'm still having issues with holidays.

I have a variable called vHolidays listing all the holidays so that's available. 

If possible i would love to solve this using set analysis and somehow only sum or average the last 10 non zero values.

I've tried nesting a bunch of if above statements to get the previous values instead of zero, but then i need to evaluate only distinct values instead and i didn't solve it.

I would appreciate any suggestions. 

table.jpg

0 Replies