Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to state "not equal to current month" under script

Hi,

I am not sure how to state "not equal to current month" under script

NinthStats2:    //Table name

NoConcatenate Load

    ...

    ...

    ninth_LastRead_MY          //format is 'MMM-YYYY', e.g. Jan 2015, Feb 2015...

    if(month(ninth_LastRead_MY)<>month(today()),'Inactive','Active') as ninth_activity

Resident NinthStats1;

Drop Table NinthStats1;

The error I got:

As I want to create a column (ninth_activity) that is either Inactive or active.

So if month(ninth_LastRead_MY) is not equal to month(today()) which is Nov, it will be inactive, otherwise active.

Thank you!

Update: I miss out a (,) before 'if', problem solved

2 Replies
sinanozdemir
Specialist III
Specialist III

Since you said that your date format is MMM-YYYY, then you can try this:

if(Date(Date#(ninth_LastRead_MY, 'MMM YYYY'), 'MMM')<>month(today()),'Inactive','Active') as ninth_activity

What you are doing is that you are telling Qlik that your date field is formatted in 'MMM YYYY' with Date#() and then getting the month portion of it with Date() function.

Hope this helps.

Not applicable
Author

sinanozdemir

Thank you! I noticed that the reason it don't work is because I miss out a (,) before 'if' in the previous sentence. Nevertheless, I learn something new from your post. Thank you