Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

n-day rolling average where n is from user input, how to dynamically update mapping table when using 'as of date' approach

Hi, Gurus,

I read through rolling/moving average posts and had a not perfect solution.  In my case, user can input values in a start date and end date (Calendar object) drop down, also select a number (n) for rolling average window, and graph should display n-day rolling average against the selected date range.  I used set analysis

in expression like the below

rangesum(above(sum({$<FMT_DISCHARGE_TIME={'>=$(=VStartDate-v_moving_days+1)<=$(=VEndDate)'}>}LOS),0,v_moving_days))/rangesum(above(count({$<FMT_DISCHARGE_TIME={'>=$(=VStartDate-v_moving_days+1)<=$(=VEndDate)'}>}FMT_DISCHARGE_TIME),0,v_moving_days))

and set Static Min to be VStartDate for Dimension Axis, it would work if date range is within some days.  If user select a bigger date range, since X-Axis Scrollbar is disabled (because I set Static Min), it won't display properly.

So I tried 'as of data' approach, and it worked with 30 day rolling average.  But I don't know how to update the mapping table based on user's input for the rolling day.  If you can help, could you please kindly post an example?  Thanks in advance!

0 Replies