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

Dynamic last 15 days

Hello,

I have a line chart where i have:

Date as dimension

Expression as:

=sum({<Date_Clean={'$(vLast15Days)'}>} TotalPrice)

This gives me from today and 15 days back.

What if i want to make this dynamic, so if i select the 27 of august, it shows me 27 of august and 15days back.

Now its just static and i cannot select a date back in time.

I have these listboxed to choose:

Month, Year, Day

1 Solution

Accepted Solutions
MEllinghausen
Creator III
Creator III

Yes, and today = num(date(today())

View solution in original post

37 Replies
Clever_Anjos
Employee
Employee

What´s the content of vLast15Days?

Not applicable
Author

Its

='>=$(vPast15Days) <=$(vDateToday)

where

vDateToday = num(Date(Today(), 'YYYY-MM-DD'))

and vPast15Days = num(date(vDateToday-15, 'YYYY-MM-DD')

Clever_Anjos
Employee
Employee

Create another variable and attach a calendar to it

Change your expressions

='>=$(vPast15Days) <=$(vDateToday)

where

vDateToday = num(Date(vNewVariable, 'YYYY-MM-DD'))

and vPast15Days = num(date(vNewVariable-15, 'YYYY-MM-DD')

Not applicable
Author

Im  not sure i follow you.

Attach a calendar to it?

I already have a mastercalendar.

MayilVahanan

Hi

Try like this

=sum({<Date_Clean={">=$(=Date(Max(Date_Clean)-15))<=$(=Max(Date_Clean))}>} TotalPrice)


Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
MEllinghausen
Creator III
Creator III

you should set your  variable vdatetoday to num(date(year &'-'&month&'-'day) if you dont have the dimension day like '2013-08-04'

Marcus

Not applicable
Author

Hi,

Try this,

     =sum({<DateNum= {'>=$(=(Num(Date(Date, -15))))<=$(=(Num(Date(Date))))'}>} TotalPrice)

Not applicable
Author

sum({<Date_Clean={">=$(=(Max(Date_Clean)-15))<=$(=Max(Date_Clean))"}>} TotalPrice)

If i do like this: I will get the last 15 days, and i can select dates (but it will only show the selected date)

Not applicable
Author

my dimension date is like '2013-08-04'