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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to get values between two dates using Set Analysis

Hi

In my report I have a STOCKDATE field and a STOCKVALUE field - I want to get the value (STOCKVALUE) based on the date in the last 12 months from todays date, stock over 1year old, stock over 2 years old etc. How can I do this?

1 Solution

Accepted Solutions
Chanty4u
MVP
MVP

try this

create two variables to read the start and end date,

then try like this:

count({<Calender_Date={">=$(=Date(vStartDate,'MM/DD/YYYY'))<=$(=Date(vEndDate,'MM/DD/YYYY'))"}>}Dimension)

Note: All date format should be same.

View solution in original post

7 Replies
isingh30
Specialist
Specialist

Try this -

only({<STOCKDATE = {'date,---'}>}STOCKVALUE)


Thank you!

Chanty4u
MVP
MVP

try this

create two variables to read the start and end date,

then try like this:

count({<Calender_Date={">=$(=Date(vStartDate,'MM/DD/YYYY'))<=$(=Date(vEndDate,'MM/DD/YYYY'))"}>}Dimension)

Note: All date format should be same.

Digvijay_Singh

Something like this -

Sum({<STOCKDATE = {"<=$(=today())>=$(=addmonths(today(),-12))"}>}STOCKVALUE)

Anonymous
Not applicable
Author

I have created two variables vStartDate (=Min(STOCKDATE) and vEndDate =Max(STOCKDATE) and then the formula i used was:

SUM({<STOCKDATE={">=$(=Date(vStartDate,'MM/DD/YYYY'))<=$(=Date(vEndDate,'MM/DD/YYYY'))"}>}STOCKVALUE)

I get 0... not sure why? what have i done wrong?

Anonymous
Not applicable
Author

my STOCKDATE field is a datetime field if that makes a difference?

Anonymous
Not applicable
Author

Using Sum({<STOCKDATE1={"<=$(=today())>=$(=addmonths(today(),-12))"}>}STOCKVALUE) I get zero as well

Anonymous
Not applicable
Author

I amended my data import to convert the datetime field into just a date field and it works! Thankyou very much for your help!!