Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Rolling 30 days avg

Hi,

I have filters Date, Month, Year.

Taken date in X-axis and written the expression for rolling 30 days.

when I am selecting date, it is displaying that particular date only not previous 30 day.

please find the expression

Avg({<Day={">=$(=Date(max(Day)-30,'MM/DD/YYYY'))<=$(=Date(max(Day),'MM/DD/YYYY'))"}>}AssetRank)

could you suggest any mistakes I have done in this expression.

19 Replies
rodrigomartinez
New Contributor

Re: Rolling 30 days avg

Please test this mode.

Variables

vMaxDate = Max(Day)

vMinDate = Date(Max(Day) - 30)

Formula:

AVG({<Day = {">=$(=$(vMinDate ))<=$(=$(vMaxDate )) "}>}AssetRank).

MVP
MVP

Re: Rolling 30 days avg

I think you need to ignore selection in Date, Year and Month field and assuming Day looks like this 07/12/2016 (full date), it will drive all your selections

Avg({<Day={">=$(=Date(max(Day)-30,'MM/DD/YYYY'))<=$(=Date(max(Day),'MM/DD/YYYY'))"}, Date, Month, Year>}AssetRank)

Not applicable

Re: Rolling 30 days avg

Hi Sunny,

thanks for your reply.

I have applied your expression still it is not working. whatever values I am selecting simply it is displaying that values only

dimension is in this below format.

Date(Day,'MMDD')

MVP
MVP

Re: Rolling 30 days avg

What is the difference between Date and Day?

Not applicable

Re: Rolling 30 days avg

Date column is not there, y mistake instead of Day I mentioned Date.

MVP
MVP

Re: Rolling 30 days avg

Can you share a sample?

Not applicable

Re: Rolling 30 days avg

Hi Sunny,

Please find the attached sample data.

MVP
MVP

Re: Rolling 30 days avg

This looks like an export from QlikView? Raw data or just the QVW app?

Not applicable

Re: Rolling 30 days avg

Hi Sunny,

Now I have attached the sample data. please find it.