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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

creating a date variable for '3 days ago'

Hi,

I need to flag dates that have passed 3 days ago, what i'm going to do is create a visual cue on those values. i tried '=v$(EndDate) -3' in the lower visual cue... doesn't work. Please assist. I also realized that if this formula works, it will flag all the values 3 days ago OR MORE when all i need is only 3 days ago values to be flagged. Please could someone point me in the right direction. Thanks.

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hello Richard,

I would use

SET vDateFlag = Date(Today() - 3);
in the load script to initialize the variable and then use it
IF(Date(DateField) >= $(vDateFlag), then-condition, else-condition
or in set analysis like
Sum({< DateField = {'>=$(vDateFlag)'} >} Sales)


Hope this helps

View solution in original post

8 Replies
Miguel_Angel_Baeyens

Hello Richard,

I would use

SET vDateFlag = Date(Today() - 3);
in the load script to initialize the variable and then use it
IF(Date(DateField) >= $(vDateFlag), then-condition, else-condition
or in set analysis like
Sum({< DateField = {'>=$(vDateFlag)'} >} Sales)


Hope this helps

Not applicable
Author

Thanks Miguel,

Appreciate it..

Not applicable
Author

One more thing, now that i've got the variable, how would i create a visual cue in the chart properties? You can only create visual cues for expressions, i've tried using set analysis in the input box... How would i create a visual cue for those dates 3 days or more?

Not applicable
Author

I've used this if statement in the edit dimension tab and in the chart, under date it is saying error in calculated dimension, what am i doing wrong??

=IF(Date(Date) <= $(vDateFlag), null(), Date)

I'm trying to say that if Date is larger than or equal to the variable (vDateFlag) then bring the value back as null otherwise Date. Sorry for hassling..

Not applicable
Author

Can anyone help me with this??

Miguel_Angel_Baeyens

You can try

IF(Date(Date) >= Date($(vDateFlag)), Date)
not specifying "null()" in the else statement.

Not applicable
Author

Hi Richard,

see if this example helps.

Good luck!

Rainer

Not applicable
Author

Thanks allot.. All sorted out... Appreciate all the help, Have a good weekend!!