Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
ntanan
Contributor
Contributor

IF Statement to create a new column

Hi, guys. I need some help to create a conditional column. 

I have an app in the Qlik Sense, this app has two database whose are connected by a common column. 

Now, I need to create a new column using some logical expression. For example:

I have two tables: Table 1: Column "A" is a date and Table 2: Column "B" is a date

Logical expression 1: IF Column A > Column B (date in "A" older than date in "B"), then create a new column with "pull ahead" written.

Logical expression 2: IF Column A < Column B, then create a new column with "postponed" written. 

How can I do this with Qlik?

 

 

Labels (1)
3 Replies
Nicole-Smith

You can use a formula to create a calculated dimension:
if([Column A] > [Column B], "pull ahead", null())

ntanan
Contributor
Contributor
Author

Hi, I'm trying to create the formula, but returns only empty values.

I'm using the following sentence:

IF([Ad Date] < [R_Ad Date], 'Pull Ahead', null())

OR

IF([Ad Date] > [R_Ad Date], 'Posponed', null())

OR

IF([Calendar Savings] <> [R_Calendar Savings], 'Saving Update', 'No Change')

Does anyone know what's wrong?  How can I fix this?

 

Nicole-Smith

Without being able to see your data, the only thing I can think of is maybe Qlik isn't recognizing your dates as dates so the comparison may not be working.  You could try wrapping in date() or date#() to make sure Qlik knows that they are dates.

If the above doesn't work, you'll need to post some sample data in order to get further assistance.