Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Sundeep
Contributor
Contributor

How to use date diff in set analysis

Hi,

I have data like below

username value date
Name1        1         2019-04-01
Name2        2         2019-04-02
Name3        3         2019-04-03
.
.
.
Name16      16       2019-04-16

 

I want to show data in my line graph from Max(Date)-7.

Please note that every day new data will come so I need max date.

Currently I am writing formula as Avg({$date={">$(=Max(date)-7)"}>}value)

but its not working and giving error as "The chart is not displayed because it contains only undefined values."

 

Labels (1)
4 Replies
benedettitatian
Contributor
Contributor

Try this:

SUM({<date={">=$(=date(Max(date)-7,'YYYY-MM-DD'))"}>} value)

 

Sundeep
Contributor
Contributor
Author

Hi,

Tried but result is same. Getting the same error

Thanks
jonathandienst
Partner - Champion III
Partner - Champion III

Are your dates proper numeric date Values or strings? If they are strings, convert them to numeric dates using Date#(). Also correct the syntax of your expression ('<' added):

 Avg({<date={">$(=Max(date)-7)"}>} value)

 

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Sundeep
Contributor
Contributor
Author

I made the changes but still its not working. Giving me the same error