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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources 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
MVP
MVP

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
MVP
MVP

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