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: 
boorgura
Specialist
Specialist

Problem with condition in expression.

Hi guys,

I came across, something which looks a wierd behavior to me.

I have a chart, where in, the expression should have a condition.

So i have a variable created (in the variable overivew) which evaluates the recent most Friday.

its calculated as '=weekend(today(),-1,-2)'. which works fine when tested.

But in the expression, if i place the condition as if(theDate = RecentFriday,'then do this'), it doesn't work.

instead if I do if(theDate = '2/19/2010','then do this'). it works fine.

and i checked the value of the RecentFriday.... it shows 2/19/2010.

Any help would be greatly appreciated.

Thanks,

Rocky

1 Solution

Accepted Solutions
Not applicable

Hi

Have you tried using variable expansion, like this:

if(theDate = '$(RecentFriday)','then do this')

regards
/Fredrik

View solution in original post

4 Replies
vgutkovsky
Master II
Master II

Rocky,

Sometimes the problem in these cases is just date formatting. Try this as the condition: if(num(theDate) = num(RecentFriday)) and see if it works. I've also seen where the date format is actually DD/MM/YYYY even though the date shows as M/DD/YYYY. So try the above condition, and if it doesn't work try some different date-formatting combinations.

Regards,

Not applicable

Hi

Have you tried using variable expansion, like this:

if(theDate = '$(RecentFriday)','then do this')

regards
/Fredrik

Not applicable

for me it a problem of date mismatch types.

Try to Transform =weekend(today(),-1,-2) in =date(weekend(today(),-1,-2),'MM/DD/YYYY')

Hope this help

Bud

boorgura
Specialist
Specialist
Author

Thanks a lott guys...

Frederik.. you got it man.

I did try $(RecentFriday)... but did not try '$(RecentFriday)'... which worked... (just to emphasize... the quotes were missing)

Thanks all once again..

-Rocky