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

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

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


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())


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


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

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



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.