
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Error in IF statement
Hi,
I am working on a problem where every month I receive a report of all the users and the date of their account creation. Now I want to show two things on the dashboard.
1. New users
2. Existing users
So whenever I receive a new report I add a new column "Report Date" with current month value in the excel sheet itself to compare new and existing users.
Now in the load script I am trying to add a new column with True/1 and False/0 values( any value to distinguish )so that I can use the value in my dashboard. But I am receiving the error.
If(Year("Report Date")=Year("Creation Date") and Month("Report Date")=Month("Creation Date"), "New", "Old")) As "IsNewUser"
I am getting the following error
Can some one please help figuring out the wrong or suggest some approach?
Thanks,
Jay
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looks weird, may be try 'New', 'Old' with single quotes.
Can you share your script statements , few lines above and below the error statement, would like to give deeper look.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are New and Old field names or are you trying to set string values?
By using " " you are using the field name, by using ' ' you are using the string value.
Qlik Community MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It looks like you have one end paranthesis to much in your expression.
If( Year("Report Date")=Year("Creation Date") and Month("Report Date")=Month("Creation Date"), "New", "Old" )) As "IsNewUser"
Qlik Community MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Still the same error. Not sure why it is pointing towards the ,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think it looks ok, but you could try to box your comparisons inside parentheses. Like this:
If( (Year("Report Date")=Year("Creation Date")) and (Month("Report Date")=Month("Creation Date")), "New","Old" ) as "IsNewUser"
Qlik Community MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Vegar : Its still the same, showing error in the comma:
If( (Year("Report Date")=Year("Creation Date")) and (Month("Report Date")=Month("Creation Date")), "New","Old" ) as "IsNewUser"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looks weird, may be try 'New', 'Old' with single quotes.
Can you share your script statements , few lines above and below the error statement, would like to give deeper look.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are New and Old field names or are you trying to set string values?
By using " " you are using the field name, by using ' ' you are using the string value.
Qlik Community MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you..this worked 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you..this worked 🙂
New thing learnt 🙂
