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: 
MichalSa
Contributor II
Contributor II

Display data relevant to previous date from selected date

Hi 

There are so many answers that seem to answer my question - but none of them work for me.....

I want to display a moving average relevant to the previous date (day before) of the selected field.

 

My moving average formula is      RangeAvg(above (count ([Error Code]),0,7))

My date field is called [Created Date]

When the selected created date is e.g. 21/04/2020 - I want the moving average calculation be relevant to 20/04/2020 and the 7 days prior (according the moving average formula).

 

I tried RangeAvg(above (count ({< [Created Date] = {Date(max([Created Date])-1)}>} [Error Code ]),0,7))

but it brings back an error message

 

Appreciate all assistance!!

Michal

Labels (1)
2 Solutions

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

HI 

this expression will work in a table with the Date as dimension 

if(sum(Value)>0, RangeSum(Above( ( sum({<Date={">=$(=Date(max(Date)-7))"}>}Value) ) , 1, 7)))

View solution in original post

MichalSa
Contributor II
Contributor II
Author

Thanks!

Can you please explain the difference between :

RangeSum(Above( ( sum({<Date={">=$(=Date(max(Date)-7))"}>}Value) ) , 1, 7)))

and

RangeSum(Above( ( sum({<Date={">=$(=Date(max(Date)-7))"}>}Value) ) , 0, 7)))

View solution in original post

3 Replies
lironbaram
Partner - Master III
Partner - Master III

HI 

this expression will work in a table with the Date as dimension 

if(sum(Value)>0, RangeSum(Above( ( sum({<Date={">=$(=Date(max(Date)-7))"}>}Value) ) , 1, 7)))

MichalSa
Contributor II
Contributor II
Author

Thanks!

Can you please explain the difference between :

RangeSum(Above( ( sum({<Date={">=$(=Date(max(Date)-7))"}>}Value) ) , 1, 7)))

and

RangeSum(Above( ( sum({<Date={">=$(=Date(max(Date)-7))"}>}Value) ) , 0, 7)))

MichalSa
Contributor II
Contributor II
Author

Appreciate the assistance here as well: 

 

Can you please explain the difference between :

RangeSum(Above( ( sum({<Date={">=$(=Date(max(Date)-7))"}>}Value) ) , 1, 7)))

and

RangeSum(Above( ( sum({<Date={">=$(=Date(max(Date)-7))"}>}Value) ) , 0, 7)))