Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

current date minus 7 days

Hi all!

I am struggling with such expression (percentage of rate's changing between 7 days):

1- Avg(index_1)/Avg({1<date = {'current date minus 7 days'}>}index_1)

Could you help me!?

Thanks! Marina

8 Replies
Gysbert_Wassenaar

1- Avg(index_1)/Avg({1<date = {"$(=today()-7)"}>}index_1)


It's possible you need to set the date format too. If the date format of your date field is MM/DD/YYYY then you can try:

1- Avg(index_1)/Avg({1<date = {"$(=date(today()-7,'MM/DD/YYYY'))"}>}index_1)



talk is cheap, supply exceeds demand
Not applicable
Author

O, thanks a lot, and how to transform this expression if  I need "current by selected date - 7", not exactly "today")) .

Gysbert_Wassenaar

date={"$(=max(date)-7)"}


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Still, it is more reliable with date():

date={"$(=date(max(date)-7))"}

manojkulkarni
Partner - Specialist II
Partner - Specialist II

Set vSelDateMinus7 =date(max(date)-7)


1- Avg(index_1)/Avg({1<date = {'$(vSelDateMinus7 )'}>}index_1)

Not applicable
Author

all these expressions doesnt work (  I try to use it in text box..

even     Avg({1<date = {"$(= makedate(2015,4,30))"}>}index_1) doesnt show anything

What have I missed?

Anonymous
Not applicable
Author

Looks fine...  Are the field names correct?  What if you use this:

avg({1<date = {'30/04/2015'}>}index_1)

(I assume that your date format is DD/MM/YYYY.  Make corrections in the set if it is different)

Not applicable
Author

Thank u very much!!! Ive done it!!  there was a problem with data format~!