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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Use of Variable

Hello All

Kindly help me in the below logic.

I have created something not sure it is correct or not.

If the difference between Today Date and First day of the Month is Less than 6 than it picks the Last day of the previous month else Today date.

Formula I wrote is:

Date_value = IF((TODAY() - MONTHSTART(TODAY()))<6, DATE(MONTHSTART(TODAY())-1), TODAY())

I need the below two things as:

1. received_date >= Date_value - 3

2. received_date < Date_value - 3

Can someone suggest me how I can use this in set analysis

Thanks

Deepanshu

1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

You can create another variable, subtracting the 3 days and formatting the date same way as received_date (assuming its format is the default script format):

Date_value_threshold:

=Date( Date_value -3)

If it's not in the default format,add a format code to Date() function:

=Date( Date_value -3,'MM/DD/YYYY')

Then in your expressions, maybe something like

=Sum({<received_date = {">=$(Date_value_threshold)"}>} Value)

resp.

=Sum({<received_date = {"<$(Date_value_threshold)"}>} Value)

View solution in original post

2 Replies
swuehl
Champion III
Champion III

You can create another variable, subtracting the 3 days and formatting the date same way as received_date (assuming its format is the default script format):

Date_value_threshold:

=Date( Date_value -3)

If it's not in the default format,add a format code to Date() function:

=Date( Date_value -3,'MM/DD/YYYY')

Then in your expressions, maybe something like

=Sum({<received_date = {">=$(Date_value_threshold)"}>} Value)

resp.

=Sum({<received_date = {"<$(Date_value_threshold)"}>} Value)

Anonymous
Not applicable
Author

Thanks a lot sir!!

Regards

Deepanshu